CSS Basics Tutorial: Grouping selectors

Source: Internet
Author: User

Often in our CSS style there will be several places to use the same settings, a separate write will be a tiring job, too high and too long to be redundant, more difficult to manage .... CSS syntax in the basic settings, you can put the same set of selectors together, the original may be written 7~8 line of the same grammar, together after just a small line, how to see all people relaxed and happy AH ~

For example: when there are several selectors just need to set the color of the text to Gray, a separate method of writing, the feeling is very cumbersome, as follows:

    1. h1 {color: #666666;}
    2. H2 {color: #666666;}
    3. h3 {color: #666666;}
    4. h4 {color: #666666;}
    5. UL {color: #666666;}
    6. p {color: #666666;}
    7. #AAA {color: #666666;}
    8. #BBB {color: #666666;}

Clustering: combine these selectors with commas , just a short line, as follows:

    1. H1, H2, H3, H4, UL, P, #AAA, #BBB {color: #666666;}

The use of "clustering" selector can make our CSS style more concise, the future and good management and convenient modification, this is the most basic CSS grammar of the function, as long as the basic use of this is familiar, students can naturally build a beautiful CSS style then ~



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.