1.一个标签可以有多个class
.box1{
height:40px;
width:100px;
}
.box2{
background-color: skyblue;
}
#myId1{
border:1 px solid;
}
#myId2{
position: absolute;
left: 100px;
top:100px;
}
<div class="box1 box2" id="myId2">
Desgin by HBX
</div>
2.一个标签有且只能有一个id
<div class="box1 box2" id="myId2 myId1">
Desgin by HBX
</div>
这样写id选择器的样式不会生效了
但这样写是可以的
<div class="box1 box2" id="myId2">
Desgin by HBX
</div>
<div id="myId2">
Design by HBX
</div>