目标:使用合适的选择器画盒子
属性:
- width:宽度
- height:高度
- background-color:背景色
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>画盒子</title>
<style>
.red{
width: 100px;
height: 100px;
background-color: red;
}
.blue{
width: 200px;
height: 200px;
background-color: blue;
}
</style>
</head>
<body>
<div class="red">div1</div>
<div class="blue">div2</div>
</body>
</html>