CSS中的Unstyleing Anchor标签

Ste*_*own 3 css

我希望从锚标签中删除所有标准样式的下划线,粗体和颜色,以便所有锚标签都是链接而不是扰乱显示.

我试过以下但是我仍然把所有内容都用蓝色和粗体来表示这很痛苦.

a,
a:link,
a:visited,
a:hover,
a:active {
    color: inherit;
    text-decoration: inherit;
    font-weight: inherit;
}
Run Code Online (Sandbox Code Playgroud)

任何人都知道如何通过替换替换来删除样式,但实际上根本没有对链接进行样式设置,以便样式不会在锚点内打乱.

pun*_*lly 5

CSS应该工作.也许你的样式表没有加载?例如,尝试使链接的字体大小明显变大font-size:50px;.

如果链接变大但颜色/文本装饰/字体重量仍然没有继承,那么我不知道问题是什么,但如果链接保持相同的大小,那么你的问题在于将你的CSS链接到你的HTML文件.


ste*_*son 5

@Drejon 的答案几乎是我想要的,但是明确设置颜色、文本装饰和字体粗细会导致a标签不从其父级获取这些值,这正是我想要的。这是我最终使用的:

a, a:link, a:visited, a:hover, a:active {
  color: inherit;
  text-decoration: inherit;
  font-weight: inherit;
}
Run Code Online (Sandbox Code Playgroud)


Key*_*Six 2

我不太确定我是否理解。尝试一下是否有帮助:

a,
a:link,
a:visited,
a:hover,
a:active {
    color: #000000; /*color of your choosing*/
    text-decoration: none;
    font-weight: normal;
}
Run Code Online (Sandbox Code Playgroud)