Css/Training/Inheritance

From W3C Wiki
< Css‎ | Training

Inheritance

Inheritance

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

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.