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


当前回答

使用CSS。这删除了a和u元素的下划线:

a, u {
  text-decoration: none;
}

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

a {
  text-decoration: none !important;
}

其他回答

有时它会被一些渲染UI CSS覆盖。更好的用法:

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

最简单的选择是:

<a style="text-decoration: none">No underline</a>

当然,混合CSS和HTML(即内联CSS)不是一个好主意,特别是当你到处使用标签的时候。 这就是为什么把它添加到样式表中是一个好主意:

a {
    text-decoration: none;
}

甚至是JS文件中的这段代码:

var els = document.getElementsByTagName('a');

for (var el = 0; el < els.length; el++) {
    els[el].style["text-decoration"] = "none";
}

使用CSS删除文本装饰。

a {
  text-decoration: none;
}

不要忘记使用link标记来包含样式表

http://www.w3schools.com/TAGS/tag_link.asp

或者将CSS包含在网页的样式标签中。

<style>
  a { text-decoration:none; }
  p { text-decoration:underline; }
</style>

我不建议在除链接之外的任何地方使用下划线,下划线通常被接受为可点击的东西。如果它不可点击,就不要下划线。

CSS基础知识可以在w3schools学习

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

a {
  text-decoration: none;
}

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