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

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

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


当前回答

使用这个属性

border: 0;

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

其他回答

设置文本装饰:none;对于锚标记。

示例HTML。

<body>
    <ul class="nav-tabs">
        <li><a href="#"><i class="fas fa-th"></i>Business</a></li>
        <li><a href="#"><i class="fas fa-th"></i>Expertise</a></li>
        <li><a href="#"><i class="fas fa-th"></i>Quality</a></li>
    </ul>
</body>

CSS例子:

.nav-tabs li a{
  text-decoration: none;
}

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

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

文本装饰的更多标准属性

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

试试这个:

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

如果text-decoration: none或border: 0不起作用,请尝试在HTML内容中应用内联样式。

覆盖嵌套的文本装饰样式。

寻找任何::before或::after选择器,并将none显示为任何文本装饰,border-bottom等,或将属性(unset)重置为任何文本颜色属性,如:text-decoration-color, background-color等。

.boxhead .otherPage {
    color: #FFFFFF;
}

a.boxhead .otherPage:before {
    background-color: unset;
}

or

a.boxhead .otherPage:before {
    background-color: unset !important;
}