(13) Learn CSS two classes with a space and comma

Source: Internet
Author: User

1. Always see these two kinds of CSS:

A. Two class spaces connected together:

. Class1. class2{...}

B. Two class comma joined together:

. class1,.class2{...}

2. Give two examples to illustrate:

Two class spaces joined together, example a:

"Viewport"Content="Width=device-width"/> <title> Two class spacing together </title> <style type="Text/css">. classdiv {height:200px;            width:200px; Background-Color:aqua;             }. Classdiv. classp {color:hotpink; Background-color: #e7e7e7; }    </style>class="Classdiv"> <pclass="CLASSP">. Classdiv. CLASSP to my entry into force</p>. classdiv. CLASSP not valid for me</div> <pclass="CLASSP">. Classdiv. CLASSP to my entry into force</p></body>

Example a results:

Two class comma joined together, example B:

"Viewport"Content="Width=device-width"/> <title> Two class comma joined together </title> <style type="Text/css">. classdiv {height:200px;            width:200px; Background-Color:aqua;             }. Classdiv. classp {color:hotpink; Background-color: #e7e7e7; }    </style>class="Classdiv"> <pclass="CLASSP">. Classdiv. CLASSP to my entry into force</p>. classdiv. CLASSP not valid for me</div> <pclass="CLASSP">. Classdiv. CLASSP to my entry into force</p></body>

Example B results:

3. The results show that:

A is only valid for the latter in the two class, the former acts as a filter, and B is valid for all classes.

. Class1. class2{...}

(13) Learn CSS two classes with a space and comma

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.