CSS inheritance, css inheritance Style
Previous
The most basic aspect of a stacked style sheet is stack-conflicting statements are sorted by the cascade process, and the final document representation is determined accordingly. The core of this process is the particularity of the selector and its related declarations, and the inheritance mechanism.
Special
The particularity of a selector is determined by its component. The special value is expressed in four parts:
[1] inline style-> 1, 0, 0, 0
[2] ID property value-> 0, 1, 0, 0
[3] class property value, attribute selection, or pseudo class-> 0, 0, 1, 0
[4] element or pseudo element-> 0, 0, 1
[5] delimiter and wildcard selector-> 0, 0, 0
H1 {}->, p em {}->, 0, 2. grape {}-> 0, 0, 1, 0 *. bright {}-> 0, 0, 1, 0 p. bright em. dark {}->, # id121 {}->, 0, 0div # side * [href] {}->
Importance
Important: Insert a semicolon before the end of the Declaration! Important to mark
Inheritance
Inheritance is a mechanism used to pass attribute values from an element to its child element. Based on the Inheritance Mechanism, a style can be applied not only to a specified element, but also to its descendant element. The inherited attributes have no special characteristics.
[NOTE 1] in HTML, the background style applied to the body element can be passed to the html element.
[NOTE 2] <a> labels do not inherit the text style of the parent element.
Cascade
[1] sort by source and importance. Reader! Important> creator! Important> creator> reader> User Agent
[2] sort by particularity
[3] sort by the order of appearance. A declaration appears after the style sheet or document is Vietnam, and the weight is greater.