利用类选择器画三个盒子
目的:体会 多类名 的运用。
<style>
.box {
width: 100px;
height: 100px;
font-size:30px;
}
.red {
background-color: red;
}
.green {
background-color: green;
}
</style>
<body>
<div class=" box red">红色</div>
<div class="box green">绿色</div>
<div class="box red">红色</div>
</body>
效果: