Homework7
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div>1</div>
<div>2</div>
</body>
</html>
要求
- 所有div标签满足:
- 宽度和高度均为300px;
- 内边距与外边距均为10px;
- 背景颜色为lightblue;
- 边框样式为solid 10px gray;
- 第一个div为内容盒子模型;
- 第二个div为边框盒子模型;
实现:
css:
<style>
div {
width: 300px;
height: 300px;
padding: 10px;
margin: 10px;
background-color: lightblue;
}
#content-box {
box-sizing: content-box;
}
#border-box {
box-sizing: border-box;
border: solid 10px gray;
}
</style>
html+css;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div {
width: 300px;
height: 300px;
padding: 10px;
margin: 10px;
background-color: lightblue;
}
#content-box {
box-sizing: content-box;
}
#border-box {
box-sizing: border-box;
border: solid 10px gray;
}
</style>
</head>
<body>
<div id="content-box">1</div>
<div id="border-box">2</div>
</body>
</html>
实现界面;
加油