无论如何(在CSS中)避免在页面中引入的文本和链接的下划线..?
当前回答
css是
text-decoration: none;
and
text-decoration: underline;
其他回答
最简单的选择是:
<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;
}
当你想将一个锚标记简单地用作一个链接而不添加样式(如悬停时的下划线或蓝色)时,在锚标记中添加class="no-style"。然后在全局样式表中创建类no-style。
.no-style {
text-decoration: none !important;
}
这有两个好处。
它不会影响所有的锚标记,只会影响那些添加了“no-style”类的锚标记。 它将覆盖任何其他可能阻止将文本装饰设置为none的样式。
css是
text-decoration: none;
and
text-decoration: underline;
下划线可以通过称为文本装饰的CSS属性删除。
<style>
a {
text-decoration:none;
}
</style>
如果要删除除a之外元素中文本的下划线,则应使用以下语法。
<style>
element-name{
text-decoration:none;
}
</style>
还有许多其他文本装饰值可以帮助你设计链接。