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

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

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


当前回答

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

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

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

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

其他回答

使用这个属性

border: 0;

你就有保险了。当文本装饰属性完全不起作用时,它为我完美地工作。

你在错误的选择器中使用了text-decoration: none。你需要检查你需要哪个标签装饰无。

您可以使用此代码

.boxhead h2 a {
    text-decoration: none;
}

Or

.boxhead a {
    text-decoration: none !important;
}

Or

a {
    text-decoration: none !important;
}

就我而言,我使用的HTML格式很差。链接在<u>标签内,而不是<ul>标签内。

  a {
    color: unset;
    text-decoration: unset;
  }

只需将此属性添加到锚标记

风格= "文字修饰:没有”;

例子:

<a href="page.html"  style="text-decoration:none;"></a>

或者使用CSS的方式。

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