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


当前回答

当你想将一个锚标记简单地用作一个链接而不添加样式(如悬停时的下划线或蓝色)时,在锚标记中添加class="no-style"。然后在全局样式表中创建类no-style。

.no-style {
    text-decoration: none !important;
}

这有两个好处。

它不会影响所有的锚标记,只会影响那些添加了“no-style”类的锚标记。 它将覆盖任何其他可能阻止将文本装饰设置为none的样式。

其他回答

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

a {
  text-decoration: none;
}

a:hover {
  color: white;
  text-decoration: none;
  cursor: pointer;
}

使用CSS删除文本装饰。

a {
  text-decoration: none;
}

在我的例子中,有一个关于锚的悬停效应的规则,像这样:

#content a:hover {
  border-bottom: 1px solid #333;
}

当然,文字装饰:没有;在这种情况下也无能为力。 我花了很长时间才发现。

所以:下划线不要与border-bottom混淆。

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

#content a {
    text-decoration-line:none;
}

这将删除下划线。

此外,您也可以使用类似的语法来操作其他样式,使用-

text-decoration: none;
text-decoration-color: blue;
text-decoration-skip: spaces;
text-decoration-style: dotted;

希望这能有所帮助!

附注:这是我第一次回答!

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

a {
  text-decoration: none !important;
}

它的工作原理!