CSS - Inheritance

> (World Wide) Web - (W3|WWW) > CSS - Cascading Style Sheets - Markup Language (HTML|XML) Skin

1 - About

Style properties are inherited by an element’s descendants unless otherwise specified.

Advertising

3 - Example

  • The HTML
<div>
   <p>
        My parent div element got the style property through the CSS rule 
        and I, the p element, inherit its properties because I'm one of its descendant 
   </p>
   <div>
        <p>
        I'm also a descendant, second level :)
        </p>
   </div>
</div>
  • The Css
div { color: blue; }
  • The result:

web/css/inheritance.txt · Last modified: 2019/02/09 11:40 by gerardnico