CSS - Inheritance

About

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

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:





Discover More
CSS - (Implementation|Processing Model|Rendering)

How user agents may implements CSS. A user agent processes a source by going through the following steps: Parse the source document and create a document tree (CSSOM) Identify the target media...
Anonymous Block Box
CSS - Anonymous Block Box

Because a container box can only contains boxes, a anonymous text (ie a text that is not enclosed in an element) will be contained in an anonymous box. If a container box (inline or block) has a block-level...
CSS - Overflow

Generally, the content of a block box is confined to the content edges of the box. In certain cases, a box may overflow, meaning its content lies partly or entirely outside of the box. The overflow property...
CSS - Property

CSS defines a finite set of parameters, called properties, that defines the rendering of a document. Properties are written in a css rule after the element selection definition. Properties are attached...
CSS - line-height Property

On block level elements, the line-height property specifies the space between the text lines and is known as the Leading where: the value is one of: normal, - let the browser choose a reasonable...
HTML - HTML element (Document root)

The html element represents the root of a a html document (page). It would become also the root (top node) in the in-memory tree representation (DOM document) of this html page. This is also the node...



Share this page:
Follow us:
Task Runner