Curious about the name Cascading Style Sheets? The Cascade is basically the method used to decide which rule wins, when multiple rules have been applied to a site.
Often the rule that 'wins' will be the one that is most specific - for example, if you want to style all <p>
paragraph text in the document red, you might write:
p {
color: red;
}
But you may have some particular paragraphs that you want to color goldenrod, not red.
Yes, 'goldenrod' is a genuine CSS color name!
In your HTML document, you can add a class to those particular paragraphs, let's call it special
:
<p class="special"> This is not your usual paragraph, it is a little different.</p>
You can then specify a rule for the special
class in the CSS (you use a period .
to address a class):
.special {
color: orange:
}
Because a unique class is more specific than a generic <p>
paragraph, the style for special
will overrule the usual style for <p>
.