Entry
How does a parent element's style affect its child elements?
Jun 13th, 2000 05:59
Rey Nuņez, http://www.w3.org/TR/REC-CSS2/cascade.html#inheritance
Inheritance refers to the intrinsic behavior of child elements taking
on a particular property from their parent or container element.
For example, if we declare a font-family for the BODY element in a
global (external) style sheet, all elements in all pages linked to that
style sheet inherit, and are rendered with, that font.
Likewise, if a background and foreground color is declared for the DIV
element, the styles are applied to all elements within any DIV, unless
inline styles are defined, which take precedence.
In general, inheritance is a flexible and powerful means to apply style
variations, such as in our font example above. On certain occasions,
though, inheritance can be a nuisance, such as when we do not want
certain elements to take on an inherited style. This is where an
understanding of defining styles based on precedence becomes
significant.
Not all style attributes are inherited. The W3C CSS specification
indicates which style properties are and which aren't. For more
information on style inheritance, please see:
http://www.w3.org/TR/REC-CSS2/cascade.html#inheritance