Css priority notes and css priority notes

Source: Internet
Author: User

Css priority notes and css priority notes

From fantastic css

1.css priorities we use the selector's "special degree ":

  • The description contribution (for example, div, ul) of each element is 0, 0, 1
  • Each class, pseudo class (such as hover), or attribute descriptor contributes 0, 0, 1, 0
  • Each ID descriptor contributes 0, 1, 0, 0

2. The number is larger on the left. It is generally considered as follows:

3. You can selectively overwrite short attributes in css, as shown in figure

Border: 3px dotted black; border-left-color: red;

 

You can achieve a black color of three sides. Red dot border on the left

However, as shown below, no three sides are black. Red dot border on the left.

Border-left-color: red; border: 3px dotted black;

This is because the subsequent style will overwrite the previous style (for the same element ),

Therefore, when this type of selective overwrite is used, make sure that the attribute used to overwrite the shorthand property appears after the shorthand property.

 

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.