HTML and CSS Reference
In-Depth Information
Taking classes further…
You've already written one rule that uses the greentea class to change any
paragraph in the class to the color “green”:
p.greentea {
color: green;
}
But what if you wanted to do the same to all <blockquote> s?
Then you could do this:
blockquote.greentea, p.greentea {
color: green;
}
And in your HTML you'd write:
<blockquote class="greentea">
So what if I want to
add <h1>, <h2>, <h3>, <p>, and
<blockquote> to the greentea
class? Do I have to write one
huge selector?
No, there's a better way. If you want all
elements that are in the greentea class to
have a style, then you can just write your
rule like this:
.greentea {
color: green;
}
 
Search WWH ::




Custom Search