#box,.box{
width: 100px;
height: 100px;
margin: 10px auto;
color: #fff;
text-align: center;
}
<div id="box" style="background: red;">box1</div>
<div class="box" style="background: blue;">box2</div>
效果
#box,.box{
width: 100px;
height: 100px;
margin: 10px auto;
color: #fff;
text-align: center;
}
<div id="box box1" style="background: red;">box1</div>
<div class="box box2" style="background:blue;">box2</div>
效果
当id名有两个时,css设置样式无效
当class名有两个时,css样式依然有效