如何删除锚点(链接)的下划线?

Ste*_*ven 300 html css underline

无论如何(在CSS中)是为了避免页面中引入的文本和链接的下划线..?

Emi*_*röm 490

使用CSS.这将删除au元素的下划线:

a, u {
    text-decoration: none;
}
Run Code Online (Sandbox Code Playgroud)

有时您需要覆盖元素的其他样式,在这种情况下,您可以!important在规则上使用修饰符:

a {
    text-decoration: none !important;
}
Run Code Online (Sandbox Code Playgroud)

  • 通常最好避免使用`!important`并使用特殊性和基数来覆盖样式,否则你最终可能会得到一个充满`!important`的样式表,而不需要了解必要的结构.这是代码味道IMO. (7认同)
  • 这很重要 (4认同)

Dan*_*Dan 26

css是

text-decoration: none;
Run Code Online (Sandbox Code Playgroud)

text-decoration: underline;
Run Code Online (Sandbox Code Playgroud)


小智 16

这将删除您的颜色以及锚标记存在的下划线

 a {
     text-decoration: none ;
  }
a:hover
  {
    color:white;
    text-decoration:none;
    cursor:pointer;
   }
Run Code Online (Sandbox Code Playgroud)


小智 10

我在网络打印中一直被这个问题困扰并解决了。验证结果。

a {
  text-decoration: none !important;
}
Run Code Online (Sandbox Code Playgroud)

有用!


小智 8

最佳选择:

<a style="text-decoration: none">No underline</a>
Run Code Online (Sandbox Code Playgroud)

经过测试a,a a- 就像一个魅力.


Ala*_*avi 6

使用CSS删除text-decorations.

a {
    text-decoration: none;
}
Run Code Online (Sandbox Code Playgroud)


小智 5

如果您只想从锚链接中删除下划线,则是您的最佳选择-

    #content a{
                text-decoration-line:none;
                }
Run Code Online (Sandbox Code Playgroud)

这将删除下划线。

此外,您也可以使用类似的语法来处理其他样式,

                text-decoration: none;
                text-decoration-color: blue;
                text-decoration-skip: spaces;
                text-decoration-style: dotted;
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助!

PS-这是我的第一个答案!