HTML and CSS Reference
In-Depth Information
So, what happens if, after all
this, I still don't have any rules
with a property declaration for
the property value I'm trying to
figure out?
Ah, good question. We actually talked about this a little in
Chapter 7. If you don't find a match for the property in
any rules in the cascade, then you try to use inheritance.
Remember that not all properties are inherited, like
border properties, for instance. But for the properties that
are inherited (like color , font-family , line-height ,
and so on), the browser looks at the ancestors of the
element, starting with its parent, and tries to find a value
for the property. If it does, there's your property value.
Got it. Hey, but what if the
property isn't inherited or
I can't find a value in the
ancestor's rules? Then what?
Then the only thing left to do is fall back
on the default values that are set in the
browser's stylesheets, and all browsers
should have default styles for every element.
Oh, and why
is this called the
“cascade” anyway?
The name “cascade” was chosen because of the
way that styles coming from multiple stylesheets can
all “cascade” down into the page, with the most speciic
styling being applied to each element. (If that doesn't clear
things right up for you about why it's called cascade, don't
feel bad. It didn't make it any clearer for us, either. Just
call it “CSS” and move on.)
Search WWH ::




Custom Search