如何删除 html 超链接“a”标签的默认链接颜色?

新手上路,请多包涵

默认链接颜色为蓝色。如何删除 html 超链接标记的默认链接颜色 <a>

原文由 Rafiu 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 604
2 个回答

继承价值

 a { color: inherit; }

…将使元素呈现其父元素的颜色(这就是我认为您正在寻找的颜色)。

现场演示如下:

 a {
  color: inherit;
}
 <p>The default color of the html element is black. The default colour of the body and of a paragraph is inherited. This
  <a href="http://example.com">link</a> would normally take on the default link or visited color, but has been styled to inherit the color from the paragraph.</p>

原文由 Quentin 发布,翻译遵循 CC BY-SA 4.0 许可协议

尝试这样的事情:

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

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

如果 text-decoration 不起作用,请将其更改为:

 text-decoration: none !important;

!important 规则覆盖了 text-decoration 属性的所有其他样式。您可以 在此处 阅读更多相关信息。

原文由 kleinohad 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题