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

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

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


当前回答

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

其他回答

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

您可以使用此代码

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

Or

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

Or

a {
    text-decoration: none !important;
}

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

寻找任何::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;
}

下面是一个ASP的例子。NET Web Forms LinkButton控件:

 <asp:LinkButton ID="lbmmr1" runat="server" ForeColor="Blue" />

后台代码:

 lbmmr1.Attributes.Add("style", "text-decoration: none;")

有时您会看到框影,而不是文本下划线。

试试这个(使用任何适合你的CSS选择器):

a:hover, a:visited, a:link, a:active {

    text-decoration: none!important;

    -webkit-box-shadow: none!important;
    box-shadow: none!important;
}

正如其他人指出的那样,你似乎无法覆盖嵌套的文本装饰样式……但是你可以改变文字装饰颜色。

作为一个hack,我把颜色改为透明:

    text-decoration-color: transparent;