html:
<div id="content">
<p> some text </p>
<a href="#"> some link aaa </a>
<a href="#"> some other link bbb</a>
</div>
样式:
#content a
{
color: #red;
text-decoration: underline;
}
.blue { color: #blue; }
我喜欢用 css 设计“some other link bbb”。但我喜欢另一个链接是不同的颜色。我尝试将类添加到,但没有运气..它被 a 覆盖
我该怎么做?
那为什么?
最佳答案
那里有 CSS 特异性问题。 HTML 狗有 a good tutorial对此。
来自文章:
The actual specificity of a group of nested selectors takes some calculating. Basically, you give every id selector ("#whatever") a value of 100, every class selector (".whatever") a value of 10 and every HTML selector ("whatever") a value of 1. Then you add them all up and hey presto, you have the specificity value.
关于html - 样式 <a> 链接一次不同的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7840228/