I have the following:
<section class="main_section">
<article>
...
</article>
</section>
In my stylesheet I have:
.main_section article {
background-color:#fff;
/* ... */
}
The article is styled, and I am happy about it. Now, for a single instance of article
, I want to do the following:
<section class="main_section">
<article class="special-bg">
...
</article>
</section>
Which I have defined:
.special-bg {
background-color: #276a7f;
}
But the class is not setting the background-color. It seems that the styling of the html tag article
takes precedence, no matter the order of the CSS rules in my stylesheet.
How can I overwrite a CSS property of an styled html tag by using a styling class? Is this at all possible? Any alternative?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…