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