Prev | Current Page 175 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"


121 The Cascade, Specificity, and Inheritance
The conclusion of this whole process is that the CSS property for the element is
set. However, you may be wondering about all the properties the CSS cascade doesn??™t
set. For example, what happens when there??™s no applicable declaration to set the
color property for an element? How does it get a foreground color? In the absence
of such a declaration, some properties are inherited from the parent of the element.2
The alternative to relying on the inheritance mechanism is to use the property value
inherit. Doing so ensures that the inherited value is included in the CSS cascade
calculations, but be careful when you use inherit, as browser support for this
property value is limited in Internet Explorer.3 If a property isn??™t set via the CSS
cascade, and it??™s not inherited, it??™s up to the user agent to supply a default value for
the property.
The Cascade in Action
Let??™s explore the cascade??™s effect on a particular element. Consider this HTML
fragment:


Pages:
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187