【发布时间】:2016-03-29 01:35:48
【问题描述】:
我想知道对于 href 的“a”属性如何禁用下划线。我觉得这很烦人,我想知道是否可以在我的 .css 中添加一些代码来更改它。谢谢。
【问题讨论】:
我想知道对于 href 的“a”属性如何禁用下划线。我觉得这很烦人,我想知道是否可以在我的 .css 中添加一些代码来更改它。谢谢。
【问题讨论】:
一个简单的谷歌搜索提供了这非常容易......
a {
text-decoration: none;
}
【讨论】:
只需设置a {text-decoration:none}
实际操作:
a {
text-decoration: none
}
<a href="#">No Underline</a>
编辑 (我正在编辑这个给投反对票的人,因为这可能是唯一的原因)
如果您有多个a,其中一些没有href 属性,那么您可以像这样定位href:
/*demo */
div {
border: dotted lightblue;
margin: 10px;
font-size:30px
}
a {
display: block;
}
/*in action*/
div:last-of-type a[href] {
text-decoration: none
}
<div>
<a>Without href doesn't make it a link</a>
<a href="#">Link with Underline</a>
</div>
<div>
<a>Without href doesn't make it a link</a>
<a href="#">Link Without Underline</a>
</div>
【讨论】: