css - 用 h3 样式覆盖链接 CSS

标签 css

我正在处理一个显示图像的页面,然后在底部有文本链接到特定页面。

默认情况下,链接是灰色的,但我想覆盖它并让文本采用 h3 样式。

这是 CSS:

h3{
color: #a60000;
font-size: 20px;
font-weight: normal;
font-style: normal;
font-family: mpluslight;
}

a {
color: #CCC;
font-weight: normal;
}

这是 HTML:

<h3><a href="http://mydomain.gr/">Personal Training</a></h3>

我尝试将 h3 值更改为“!important”,但这没有用。

我尽量避免使用内联 CSS。尽量保持我的代码干净。

有什么想法吗?

最佳答案

你需要这样做:

h3 a { color: #a60000; }

...或者可能是这样的:

h3 a { color: inherit; }

关于css - 用 h3 样式覆盖链接 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13202827/

相关文章:

jquery - 叠加层从中心淡出

css - Bootstrap : move descriptions from column titles to row names on mobile

html - 我无法使用溢出使我的 html 正文滚动

jquery - Bootstrap 4 网格系统 div 在崩溃时消失

html - 在保持高度的同时对齐图像

javascript - 当类存在于 HTML 中时,document.getElementsByClassName 创建空数组

html - 连续html中的一些行

html - HTML 中的边框

html - 为什么我不能更改标签的字体大小?

css - 谷歌验证码 2.0 : weird too large white background