默认的链路颜色为蓝色。 我如何删除html超链接标签< >的默认链接颜色?


当前回答

试试这样做:

a {
    color: #0060B6;
    text-decoration: none;
}

a:hover {
    color:#00A0C6; 
    text-decoration:none; 
    cursor:pointer;  
}

如果文本装饰不起作用,将其更改为:

text-decoration: none !important;

important规则将覆盖text-decoration属性的所有其他样式。你可以在这里阅读更多信息。

其他回答

简单地添加到CSS中,

a {
    color: inherit;
    text-decoration: none;
}

就这样,完成了。

.cancela,.cancela:link,.cancela:visited,.cancela:hover,.cancela:focus,.cancela:active{
    color: inherit;
    text-decoration: none;
}

我觉得有必要发布上面的类定义,很多关于SO的答案错过了一些状态

试试这样做:

a {
    color: #0060B6;
    text-decoration: none;
}

a:hover {
    color:#00A0C6; 
    text-decoration:none; 
    cursor:pointer;  
}

如果文本装饰不起作用,将其更改为:

text-decoration: none !important;

important规则将覆盖text-decoration属性的所有其他样式。你可以在这里阅读更多信息。

我也想删除标签的默认蓝色链接颜色。 当我使用bootstrap版本5时,我决定在bootstrap文档中寻找解决方案。 我搜索了“链接颜色”,结果是这个链接:“https://getbootstrap.com/docs/5.0/helpers/colored-links/”

bootstrap版本5.0有一个类,自定义链接的颜色,我发现非常有帮助,我也能够改变我的'a'标签的默认蓝色没有任何麻烦。

希望这对你有帮助。

可以使用CSS 2.0引入的System Color(18.2)值,但在CSS 3中已弃用。

a:link, a:hover, a:active { color: WindowText; }

这样,您的锚链接将具有相同的颜色与正常的文档文本在这个系统上。