如何删除<a>标签中的装饰?

STE*_*bui 0 html css

如何使<p>标签中的装饰文本不被<a>标签覆盖?

a {
  text-decoration: none !important
}

#paragraph {
  color: black;
}
Run Code Online (Sandbox Code Playgroud)
<p id="paragraph"><a href="#">this is a link</a></p>
Run Code Online (Sandbox Code Playgroud)

我的问题是我希望文本颜色p是黑色而不是蓝色.

我找到了这个,但没有用 如何删除锚点(链接)的下划线?

请大家解释一下.所有的帮助表示赞赏.

Ale*_*nic 6

最好的方法是使用inherit,因此它将取决于父母的财产.

a { color: inherit; text-decoration: inherit }
Run Code Online (Sandbox Code Playgroud)