Skip to content

Latest commit

 

History

History
40 lines (24 loc) · 1.11 KB

inheritedAndNonInheritedProperties.md

File metadata and controls

40 lines (24 loc) · 1.11 KB

Inherited and Non-Inherited Properties

Inheritance controls what happens when no value is specified for a property on an element.

Inherited properties

When no value for an inherited property has been specified on an element, the element gets the computed value (value transferred from parent to child during inheritance) of that property on its parent element.

An example of inherited property is the color property

p{ color: green; }
<p>This paragraph has <em>emphasized text</em></p>

The words "emphasized text" will appear green, since the em element has inherited the property color from its parent element.


Non-inherited properties

When no value for a non-inherited property has been specified on an element, the element gets the initial value of that property on its parent element.

Example of non-inherited property: border

p{ border: medium solid; }
<p>This paragraph has <em>emphasized text</em> in it.</p>

The words "emphasized text" will not have a border.

Source