CSS learning (7) inheritance, property value calculation process

Child elements will inherit some of the attributes of the parent element css

Can usually be inherited with the font-related properties, can check whether a specific inheritable property in mdn

Attribute value calculation process (rendering)

Carried out in order to render in a tree directory structure of the pages of the document

Prerequisites: All rendered elements of CSS attributes must have a value

An element from all property values are not all properties have values, this calculation process, called the attribute value calculation process

(The following four steps, each step may determine that some of the property value, there is no determined, the next step is determined to continue)

determine the value statement : Reference stylesheet does not declare the conflict, as the CSS property values (such as author style sheets do not, the browser's default has a value, then use the browser)

stacked conflict : Cascading Style Sheets rules declare a conflict in determining the value of CSS properties

the use of inheritance : for still no property value, if can be inherited, the inherit value of the parent element

use the default value : not yet determined the final value (value not the browser settings) using default values

 

Tip: Forced inherited   color: inherit; inherits the value of the parent element, and some can not inherit the property, you can also use this method.

Use the default value : color: initial; when I do not know what the default values when using this approach.

Guess you like

Origin www.cnblogs.com/1016391912pm/p/11564183.html