Html 如何在悬停时从名称中删除下划线
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7188768/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to remove underline from a name on hover
提问by Joper
I have such html:
我有这样的html:
<legend class="green-color"><a name="section1">Section</a></legend>
legend.green-color{
color:green;
}
In my case Section
looking green, but when i put mouse pointer on it it became looking like an a href, but i want it stay just the same without underline and changing color.
在我的情况下Section
看起来是绿色的,但是当我把鼠标指针放在它上面时它看起来像一个 href,但我希望它保持不变,没有下划线和改变颜色。
Is it possible to achieve without changing css or with minimum css cahnge?
是否可以在不更改 css 或使用最小 css 更改的情况下实现?
or may be somehow with jquery?
或者可能以某种方式使用jquery?
回答by Harry Joy
try this:
尝试这个:
legend.green-color a:hover{
text-decoration: none;
}
回答by Adithya Surampudi
Remove the text decoration for the anchor tag
删除锚标记的文本装饰
<a name="Section 1" style="text-decoration : none">Section</a>
回答by Small Hadron Collider
You can use CSS under legend.green-color a:hover
to do it.
你可以在下面使用 CSSlegend.green-color a:hover
来做到这一点。
legend.green-color a:hover {
color:green;
text-decoration:none;
}
回答by Chris
To keep the color and prevent an underline on the link:
要保持颜色并防止链接上有下划线:
legend.green-color a{
color:green;
text-decoration: none;
}
回答by Raymond Wachaga
You can assign an id to the specific link and add CSS. See the steps below:
您可以为特定链接分配一个 id 并添加 CSS。请参阅以下步骤:
1.Add an id of your choice (must be a unique name; can only start with text, not a number):
1.添加您选择的id(必须是唯一的名称;只能以文本开头,不能以数字开头):
<a href="/abc/xyz" id="smallLinkButton">def</a>
Then add the necessary CSS as follows:
#smallLinkButton:hover,active,visited{ text-decoration: none; }
然后添加必要的 CSS,如下所示:
#smallLinkButton:hover,active,visited{ text-decoration: none; }
回答by BaiJiFeiLong
legend.green-color{
color:green !important;
}