An element can have multiple class selectors at the same time. Note that when multiple class selectors are conflicting, the last class selector in the CSS file has the highest precedence.
In the following example,,<div> has CLS1 and cls2 two class selectors, note that they are written in order to be separated by a space in a class identifier.
Cases:
HTML file:
<title> an element has multiple class selectors at the same time </title>
<link rel= "stylesheet" type= "Text/css" href= "Test.css"/>
<body>
<div class= "Cls1 cls2" > Thank you for visiting www.bianceng.cn, I hope to help you! </div>
</body>
Content of Test.css:
/* An element has multiple class selectors at the same time.
. cls1{
color:red;
font-size:40px;
Font-style:italic;
Text-decoration:none;
}
. cls2{
Color:blue;
Font-weight:bold;
Text-decoration:underline;
}
The effect of the following figure:
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/web/Css/