如何在IE中将鼠标悬停在图像上时删除下划线?

时间:2022-11-19 23:26:16

如何在IE中将鼠标悬停在图像上时删除下划线?

I'm using data tables and each row in the table has a column for icons. I noticed that in Chrome and in Firefox when I hover over the icons, it changes colour (which is fine). However, in IE, when a user hovers over the icon, the icon is underlined until the user moves the cursor. I have tried:

我正在使用数据表,表中的每一行都有一个图标列。我注意到在Chrome和Firefox中,当我将鼠标悬停在图标上时,它会改变颜色(这很好)。但是,在IE中,当用户将鼠标悬停在图标上时,图标会加下划线,直到用户移动光标。我试过了:

tr td a i:hover{

text-decoration: none !important;  
}

but that didn't work for me. I also wrapped the icons in a display-inline but it still doesn't work. Please Help

但这对我不起作用。我还将图标包装在显示内联中,但它仍然不起作用。请帮忙

5 个解决方案

#1


1  

assign the anchor tag a class:

为锚标签分配一个类:

<a class='NoUnderline'>blah blah</a>

Then take off the text decoration at the anchor tag level. CSS:

然后在锚标记级别取消文本修饰。 CSS:

a.NoUnderline
{
    text-decoration:none;
}

#2


1  

You have to give border:none to image tag

你必须给border:none to image标签

CSS

img{
 border:none;
}
tr td a:hover{

   text-decoration: none !important;  
}

#3


0  

We really don't know what your environment is like with no code.

没有代码我们真的不知道你的环境是什么样的。

But you could try.

但你可以试试。

.element:hover {text-decoration: none; border: 0px}

or

img:hover {text-decoration: none; border: 0px}

If it doesn't work; try adding it with !important or within the <head></head> of your document. (but if you coded this correctly you shouldn't have to do this kind of practice)

如果它不起作用;尝试使用!important或在文档的 中添加它。 (但如果您正确编码,则不必进行此类练习)

#4


0  

The problem is that the image itself doesn't have an underline but the anchor tag surrounding the image does.

问题是图像本身没有下划线但是图像周围的锚标签有。

To remove all underlines from the anchors you have to do this:

要删除锚点的所有下划线,您必须执行以下操作:

tr td a:hover{
   text-decoration: none !important;  
}

However, if you don't want to remove the underline from all anchors within a table cell, you would need to specifiy a class:

但是,如果您不想从表格单元格中的所有锚点中删除下划线,则需要指定一个类:

tr td a.nounderline:hover{
   text-decoration: none !important;  
}

And set the anchors class attribute to nounderline.

并将anchors类属性设置为nounderline。

#5


0  

Try setting the :hover selector to include text-decoration: none;

尝试将:hover选择器设置为包含text-decoration:none;

example:

yourelement:hover{
    text-decoration: none;
}

#1


1  

assign the anchor tag a class:

为锚标签分配一个类:

<a class='NoUnderline'>blah blah</a>

Then take off the text decoration at the anchor tag level. CSS:

然后在锚标记级别取消文本修饰。 CSS:

a.NoUnderline
{
    text-decoration:none;
}

#2


1  

You have to give border:none to image tag

你必须给border:none to image标签

CSS

img{
 border:none;
}
tr td a:hover{

   text-decoration: none !important;  
}

#3


0  

We really don't know what your environment is like with no code.

没有代码我们真的不知道你的环境是什么样的。

But you could try.

但你可以试试。

.element:hover {text-decoration: none; border: 0px}

or

img:hover {text-decoration: none; border: 0px}

If it doesn't work; try adding it with !important or within the <head></head> of your document. (but if you coded this correctly you shouldn't have to do this kind of practice)

如果它不起作用;尝试使用!important或在文档的 中添加它。 (但如果您正确编码,则不必进行此类练习)

#4


0  

The problem is that the image itself doesn't have an underline but the anchor tag surrounding the image does.

问题是图像本身没有下划线但是图像周围的锚标签有。

To remove all underlines from the anchors you have to do this:

要删除锚点的所有下划线,您必须执行以下操作:

tr td a:hover{
   text-decoration: none !important;  
}

However, if you don't want to remove the underline from all anchors within a table cell, you would need to specifiy a class:

但是,如果您不想从表格单元格中的所有锚点中删除下划线,则需要指定一个类:

tr td a.nounderline:hover{
   text-decoration: none !important;  
}

And set the anchors class attribute to nounderline.

并将anchors类属性设置为nounderline。

#5


0  

Try setting the :hover selector to include text-decoration: none;

尝试将:hover选择器设置为包含text-decoration:none;

example:

yourelement:hover{
    text-decoration: none;
}