css代碼:
.box{ width:100px; height:100px; background-color:red;}
html代碼:
<div class="box">我是div</div>
<h1 class="box">我是h1</h1>
<p class="box">我是p</p>
2.不同的選擇器用,隔開,如:
css代碼:
.box,.box1,#box2{ width:100px; height:100px; background-color:red;}
html代碼:
<div class="box">我是div</div>
<h1 class="box1">我是h1</h1>
<p id="box2" 我是p</p>