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

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

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


当前回答

在我的重置,CSS通常是:

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

其他回答

锚标记(link)也有伪类,如visited、hover、link和active。确保您的样式应用于有问题的状态,并且没有其他样式冲突。

例如:

a:hover, a:visited, a:link, a:active
{
    text-decoration: none;
}

有关用户操作伪类:hover、:active和:focus的更多信息,请参阅W3.org。

在我的重置,CSS通常是:

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

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

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

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

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

后台代码:

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