CSS/Training/Inheritance

From Web Education Community Group
< CSS‎ | Training
Revision as of 11:08, 20 November 2011 by Rworth (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Inheritance

Inheritance

Some values are inherited by the children of an element in the document tree:

Inheritance.png

Example

The 'font-size' property for the h1 element will have the computed value '13pt' (130% times 10pt, the parent's value). Since the computed value of 'font-size' is inherited, the em element will have the computed value '13pt' as well.

[style.css]

 body { font-size: 10pt }
 h1 { font-size: 130% }

[index.html]

<body>
  <h1>A <em>large</em> heading</h1>
</body>


See also 6.2 Inheritance.


In the next chapter, you will learn the priority level of selectors.