<a class="c1 c2">aa</a>
Include both class strings in a single class attribute value, with a space in between.
<a class="c1 c2" > aa </a>
Separate 'em with a space.
<div class="c1 c2"></div>
This is very clear that to add two classes in single div, first you have to generate the classes and then combine them. This process is used to make changes and reduce the no. of classes. Those who make the website from scratch mostly used this type of methods. they make two classes first class is for color and second class is for setting width, height, font-style, etc. When we combine both the classes then the first class and second class both are in effect.
.color_x000D_
{background-color:#21B286;}_x000D_
.box_x000D_
{_x000D_
width:"100%";_x000D_
height:"100px";_x000D_
font-size: 16px;_x000D_
text-align:center;_x000D_
line-height:1.19em;_x000D_
}_x000D_
.box.color_x000D_
{_x000D_
width:"100%";_x000D_
height:"100px";_x000D_
font-size:16px;_x000D_
color:#000000;_x000D_
text-align:center;_x000D_
}
_x000D_
<div class="box color">orderlist</div>
_x000D_
As others have pointed out, you simply delimit them with a space.
However, knowing how the selectors work is also useful.
Consider this piece of HTML...
<div class="a"></div>
<div class="b"></div>
<div class="a b"></div>
Using .a { ... }
as a selector will select the first and third. However, if you want to select one which has both a
and b
, you can use the selector .a.b { ... }
. Note that this won't work in IE6, it will simply select .b
(the last one).
.color_x000D_
{background-color:#21B286;}_x000D_
.box_x000D_
{_x000D_
width:"100%";_x000D_
height:"100px";_x000D_
font-size: 16px;_x000D_
text-align:center;_x000D_
line-height:1.19em;_x000D_
}_x000D_
.box.color_x000D_
{_x000D_
width:"100%";_x000D_
height:"100px";_x000D_
font-size:16px;_x000D_
color:#000000;_x000D_
text-align:center;_x000D_
}
_x000D_
<div class="box color">orderlist</div>
_x000D_
.color_x000D_
{background-color:#21B286;}_x000D_
.box_x000D_
{_x000D_
width:"100%";_x000D_
height:"100px";_x000D_
font-size: 16px;_x000D_
text-align:center;_x000D_
line-height:1.19em;_x000D_
}_x000D_
.box.color_x000D_
{_x000D_
width:"100%";_x000D_
height:"100px";_x000D_
font-size:16px;_x000D_
color:#000000;_x000D_
text-align:center;_x000D_
}
_x000D_
<div class="box color">orderlist</div>
_x000D_
.color_x000D_
{background-color:#21B286;}_x000D_
.box_x000D_
{_x000D_
width:"100%";_x000D_
height:"100px";_x000D_
font-size: 16px;_x000D_
text-align:center;_x000D_
line-height:1.19em;_x000D_
}_x000D_
.box.color_x000D_
{_x000D_
width:"100%";_x000D_
height:"100px";_x000D_
font-size:16px;_x000D_
color:#000000;_x000D_
text-align:center;_x000D_
}
_x000D_
<div class="box color">orderlist</div>
_x000D_
Source: Stackoverflow.com