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

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

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


当前回答

只需将此属性添加到锚标记

风格= "文字修饰:没有”;

例子:

<a href="page.html"  style="text-decoration:none;"></a>

或者使用CSS的方式。

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

其他回答

将以下HTML代码放在 <身体>标记:

<STYLE>A {text-decoration: none;

设置文本装饰:none;对于锚标记。

示例HTML。

<body>
    <ul class="nav-tabs">
        <li><a href="#"><i class="fas fa-th"></i>Business</a></li>
        <li><a href="#"><i class="fas fa-th"></i>Expertise</a></li>
        <li><a href="#"><i class="fas fa-th"></i>Quality</a></li>
    </ul>
</body>

CSS例子:

.nav-tabs li a{
  text-decoration: none;
}

您错过了锚标记的文本修饰:none。所以代码应该如下所示。

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

文本装饰的更多标准属性

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

您可以使用此代码

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

Or

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

Or

a {
    text-decoration: none !important;
}

没有一个答案对我有用。在我的案例中,有一个标准

a:-webkit-any-link {
    text-decoration: underline;

在我的代码中。基本上不管链接是什么,文本颜色都是蓝色,链接保持原样。

所以我在header的末尾添加了这样的代码:

<head>
  </style>
    a:-webkit-any-link {
      text-decoration: none;
    }
  </style>
</head>

问题已经解决了。