我正在努力摆脱当您将鼠标悬停在HTML中的a
元素上时出现的下划线链接。我向a
链接添加了一个style="text-decoration: none"
属性,但是当我将鼠标放在文本上时,会出现下划线。
我还尝试使用这个CSS:
.nounderline {
text-decoration: none;
}
.nounderline a:hover {
text-decoration: none;
}
然后在a
链路上设置nounderline
类。
发布于 2018-07-27 05:43:14
你应该这样做
<a href="" class="nounderline">Text</a>
css开始了
.nounderline{text-decoration:none;}
此外,如果您希望所有a
标签上的下划线都应该删除,则添加css
a{text-decoration:none;}
更新:我删除了!important
。如果您正在尝试覆盖该属性,则可能需要添加该属性。
发布于 2018-07-27 05:42:08
如果你在css中的none
后面添加一个!important
,下划线应该会消失。好吧,如果你只使用html和css,而且你的css链接正确,它就会消失。
发布于 2018-07-27 05:44:14
Working example and a thumbs down? How is that possible? lol
.nounderline{
text-decoration: none
}
.nounderline:hover{
text-decoration: none
}
<a class="nounderline" href="http://example.com">Link</a>
https://stackoverflow.com/questions/51547856
复制相似问题