Overlay of "CSS" background

Source: Internet
Author: User
Tags tagname
1. Style Overlay Problem description

Phenomenon: Class1 is the DOM node default style, Class2 the DOM node and adds style, discovers Class2 background is Class1 overwrite

Solution: Use!import emphasis in Class2 's background

2. CSS style Overlay principle analysis

1) CSS styles are imported in two ways: a. Outer style--external file B. Inline style--HTML style node, DOM node forced binding

Precedence is inline-dom node force binding > inline-HTML style node > Outreach

2) CSS selector precedence inline style > ID > class= pseudo-class > TagName = Pseudo element

The weights were

Inline: 1000

id:100

class/Pseudo-Category: 10

TagName/For elements: 1

The weights of the descendant selectors are the sum of each weight value.

After the same weight, the loaded CSS file will overwrite the previous loaded

3)!import property is not overwritten

Overlay of "CSS" background

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.