CSS compound selector rules and CSS priority Determination

Source: Internet
Author: User

Rules for using CSS compound Selector

1. ID nested class # myid. myclass: <p id = "SP" class = "myclass"> </P>.

2. One element label uses multiple classes .. Important. Warning <P class = "important warning"> be sure not to have spaces. Two classes are supported with spaces.
3. Class elements in the ID label. # Myid. myclass <Div id = "myid"> <P class = "myclass"> </P> </div>
4. class under the element label. P. myclass <p> <SPAN class = "myclass"> </span> </P>
4. ID under the element label. P # myid <p> <span id = "myid"> </span> </P>
5. Element labels under the class. . Myclass span <P class = "myclass"> <span> DD </span> </P>
6. ID label # myid # myid2 <Div id = "myid"> <Div id = "myid2"> </div>. The usage of ID is similar to that of element labels.
7. myclass1. myclass2 indicates that two classes use the same style, rather than nesting. Class can also be nested class. However, if there is no space between the two. myclasses, the two classes are owned at the same time.

8. Element tag nested element tag P span <p> <span> </P>

It's totally different if there are multiple spaces.

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.