无论如何(在CSS中)避免在页面中引入的文本和链接的下划线..?
当前回答
如果你只是想从锚链接中删除下划线,最好的选择-
#content a {
text-decoration-line:none;
}
这将删除下划线。
此外,您也可以使用类似的语法来操作其他样式,使用-
text-decoration: none;
text-decoration-color: blue;
text-decoration-skip: spaces;
text-decoration-style: dotted;
希望这能有所帮助!
附注:这是我第一次回答!
其他回答
<u>
是一个已弃用的标记。
使用……
<span class="underline">My text</span>
一个CSS文件包含…
span.underline
{
text-decoration: underline;
}
或者只是……
<span style="text-decoration:underline">My Text</span>
为这个问题提供另一个角度(从原始帖子的标题/内容推断):
如果您想要追踪是什么在HTML中创建了错误的下划线,请使用调试工具。有很多选择:
Firefox有FireBug;
Opera有蜻蜓(在工具->高级菜单中称为“开发人员工具”;Opera默认自带);
对于IE,有一个“Internet Explorer开发工具栏”,对于IE7及以下版本,可以单独下载,并集成到IE8中(点击F12)。
我对Safari、Chrome和其他少数浏览器不太了解,但你的电脑上至少应该有上述三种浏览器中的一种。
在我的例子中,有一个关于锚的悬停效应的规则,像这样:
#content a:hover {
border-bottom: 1px solid #333;
}
当然,文字装饰:没有;在这种情况下也无能为力。 我花了很长时间才发现。
所以:下划线不要与border-bottom混淆。
这将删除您的颜色以及锚标签存在的下划线
a {
text-decoration: none;
}
a:hover {
color: white;
text-decoration: none;
cursor: pointer;
}
有时它会被一些渲染UI CSS覆盖。更好的用法:
a.className {
text-decoration: none !important;
}