CSS inheritance, css inheritance Style

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.