[CSS]!important control style precedence

Source: Internet
Author: User

Let's look at the question first:



View Style:



The Background-size property is overwritten, and viewing the style properties does not reveal any redefinition in the selected state.


When the background-size is added directly, it takes effect.



Using another colleague's Chrome visit, it was found that there was no problem, the initial judgment could be a problem with the chrome version, and a few chrome tests, and sure enough



Chrome 21.0.1180 Background Rendering is different, when the background attribute is redefined, the original background properties, including Background-size, and so on all covered.


Two ways to solve this problem:

1. Redefined background Add properties such as Background-size

2. Add!important to the original Background-size property. (High-end browser support, meaning higher than inline style priority)

Such as:

background-size:40px 50px!important;


Show OK:




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.