我试图有一个链接显示在白色,没有下划线。文本颜色正确地显示为白色,但蓝色下划线顽固地坚持。我尝试了文字装饰:没有;文字装饰:none !在CSS中删除链接下划线。既不工作。

.boxhead .otherPage { 颜色:# FFFFFF; 文字修饰:没有; } < div class = "表头栏”> < h2 > <span class="thisPage">当前页面</span> <a href="myLink"><span class="otherPage">Different Page</span></a> . < / h2 > < / div >

如何从链接中删除蓝色下划线?


当前回答

您错过了锚标记的文本修饰:none。所以代码应该如下所示。

.boxhead a { 文字修饰:没有; } < div class = "表头栏”> < h2 > <span class="thisPage">当前页面</span> <a href="myLink"><span class="otherPage">Different Page</span></a> . < / h2 > < / div >

文本装饰的更多标准属性

其他回答

您错过了锚标记的文本修饰:none。所以代码应该如下所示。

.boxhead a { 文字修饰:没有; } < div class = "表头栏”> < h2 > <span class="thisPage">当前页面</span> <a href="myLink"><span class="otherPage">Different Page</span></a> . < / h2 > < / div >

文本装饰的更多标准属性

更新2023

这个问题已经有点老了。在CSS中,你可以用all: unset删除标签的所有特性。

.w { 字体大小:1.4快速眼动; } .w .s2 a, .w .s3 a { :设置; } .w .s3 a { 颜色:红色; } < div class = " w " > < div class = " s1”> <a href="">link a </a> . < / div > < div class = " s2”> <a href="">link B</a> . < / div > s3 < div class = " " > <a href="">link C</a> < / div > < / div >

一般来说,如果你的“下划线”和你的文本不是同一种颜色(并且“color:”在行内没有被覆盖),它就不是来自“text-decoration:”。它必须是“边界底部:”。

别忘了把你的伪类的边界也去掉!

a, a:link, a:visited, a:active, a:hover {border:0!important;}

这个片段假设它位于一个锚上。相应地更改它的包装…用“专一”而不是“!”在你找到根本原因之后。

虽然其他答案都是正确的,但有一个简单的方法可以去掉所有这些讨厌的链接上的下划线:

a {
   text-decoration: none;
}

这将从您的页面上的每一个链接删除下划线!

你没有应用text-decoration: none;到一个锚。Boxhead a)而是span元素(. Boxhead)。

试试这个:

.boxhead a {
    color: #FFFFFF;
    text-decoration: none;
}