Prev | Current Page 193 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"


Why is this a good thing? Consider the following code:
div {
font-size: 20px;
}


This sentence will have a 20px
font-size.
The Cascade, Specificity, and
Inheritance



If inheritance wasn??™t at work in the above code, we??™d have to specify a font-size
declaration for each element in turn, to make sure that all the content in the sentence
was rendered at 20px:
p {
font-size: 20px;
}
The Ultimate CSS Reference 134
em {
font-size: 20px;
}
a {
font-size: 20px;
}
With inheritance working in our favor, we merely have to set the font-size on the
parent; all the children will inherit the font-size automatically. This is why you
only need to set the font-size on the body element to have the whole page rendered
at that font size??”unless of course it has been explicitly defined elsewhere.
Quirks Mode Inheritance Bugs
Note that modern browsers operating in quirks mode behave a little buggily in that
they don??™t inherit certain properties into tables.


Pages:
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205