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

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

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


当前回答

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

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

后台代码:

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

其他回答

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

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

后台代码:

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

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

试试这个:

.boxhead a {
    color: #FFFFFF;
    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;
}

在我的重置,CSS通常是:

a {
  cursor: pointer;
  text-decoration: none !important;
  color: inherit;
} 

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

a {
   text-decoration: none;
}

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