I have a tag selector defined for all my heading elements (h1-h4) that I use site wide. I was simply trying to create a “highlight” for urgent messages by creating a class called “alerts” that would do some table and heading changes. I found I could not get this to work with what I understood to be a compound selector like this:
.alerts h3 {
color: #F00;
}
When I did that, the normal h3 selector in the CSS file took precedence.
When I coded it like this, it worked:
h3.alerts {
color: #F00;
}
Basically the HTML applies class=“alerts” to the tag.
I’ve read up on what should take precedence and can’t figure out why the other one works. I’d prefer to use the first style, as there are a number of different tags I want the “alerts class” to affect.
What I am missing?
Thanks!