我试图有一个链接显示在白色,没有下划线。文本颜色正确地显示为白色,但蓝色下划线顽固地坚持。我尝试了文字装饰:没有;文字装饰:none !在CSS中删除链接下划线。既不工作。

.boxhead .otherPage { 颜色:# FFFFFF; 文字修饰:没有; } < div class = "表头栏”> < h2 > <span class="thisPage">当前页面</span> <a href="myLink"><span class="otherPage">Different Page</span></a> . < / h2 > < / div >

如何从链接中删除蓝色下划线?


当前回答

就我而言,我使用的HTML格式很差。链接在<u>标签内,而不是<ul>标签内。

其他回答

没有看到那页纸,很难推测。

但听起来你可能有一个边界底部:1px纯蓝色;被应用。也许可以添加border: none;。文字装饰:没有!重要的是正确的;有可能你有另一种样式仍然覆盖这个CSS。

这就是使用Firefox Web开发工具栏非常棒的地方。你可以在那里编辑CSS,看看它是否工作,至少对Firefox是这样。它在CSS→编辑CSS。

你在错误的选择器中使用了text-decoration: none。你需要检查你需要哪个标签装饰无。

您可以使用此代码

.boxhead h2 a {
    text-decoration: none;
}

Or

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

Or

a {
    text-decoration: none !important;
}

更新2023

这个问题已经有点老了。在CSS中,你可以用all: unset删除标签的所有特性。

.w { 字体大小:1.4快速眼动; } .w .s2 a, .w .s3 a { :设置; } .w .s3 a { 颜色:红色; } < div class = " w " > < div class = " s1”> <a href="">link a </a> . < / div > < div class = " s2”> <a href="">link B</a> . < / div > s3 < div class = " " > <a href="">link C</a> < / div > < / div >

文字装饰:没有!重要的应该删除它..你确定没有边界底部:1px固体潜伏?(在IE中跟踪Firebug/F12中的计算样式)

你没有应用text-decoration: none;到一个锚。Boxhead a)而是span元素(. Boxhead)。

试试这个:

.boxhead a {
    color: #FFFFFF;
    text-decoration: none;
}