The css class overlays the value of the same attribute.

Source: Internet
Author: User

The css class overlays the value of the same attribute.

If an element uses multiple classes and one attribute value has different values in multiple classes, what is the final value of this element?

Of course, the coverage with a higher priority is lower.

Consider a css link file box and an html file.

In css:

. Form-control {width: 100%;...}. width-control {width: 60% ;}


In html:

1. <div class = "form-control width-control">... </div> 2. <div class = "width-control form-control">... </div>


The above changes the writing sequence of classes in html and finds that the valid values are width: 60%, which means that the sequential writing sequence of classes in the same class in html does not affect the overwriting sequence.


Change the sequence defined in css as follows:

. Width-control {width: 60%;}. form-control {width: 100% ;...}

The valid values are both width: 100%. This indicates that the class priority is determined by the sequence defined by the class in the css file. The higher the definition priority, the higher the definition priority!


Zookeeper

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.