-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
66 lines (65 loc) · 1.71 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>BOX</title>
<style>
body {
background-color: #f5f5f5;
}
.box-wrapper {
background-color: yellow;
}
.box {
width: 200px;
height: 200px;
background-color: green;
border: 5px solid red;
padding: 20px;
margin: 40px;
}
.box2 {
margin-top: 60px;
}
img {
width: 100%;
}
.box-float {
float: left;
}
</style>
</head>
<body>
<!-- 塌陷 -->
<div class="box-wrapper">
<div class="box">
<img src="https://beimg.oss-cn-beijing.aliyuncs.com/favicon.png!ace" />
</div>
</div>
<div class="box">
<img src="https://beimg.oss-cn-beijing.aliyuncs.com/favicon.png!ace" />
</div>
<!-- 合并 -->
<div class="box box1">
<img src="https://beimg.oss-cn-beijing.aliyuncs.com/favicon.png!ace" />
</div>
<div class="box box2">
<img src="https://beimg.oss-cn-beijing.aliyuncs.com/favicon.png!ace" />
</div>
<!-- 空元素 -->
<p style="margin-bottom: 0px;">这个段落的和下面段落的距离将为20px</p>
<div style="margin-top: 20px; margin-bottom: 20px;"></div>
<p style="margin-top: 0px;">这个段落的和上面段落的距离将为20px</p>
<!-- 浮动元素,一种防止塌陷的解决方案 -->
<div class="wrapper">
<div class="box box-float">
<img src="https://beimg.oss-cn-beijing.aliyuncs.com/favicon.png!ace" />
</div>
<div class="box box-float">
<img src="https://beimg.oss-cn-beijing.aliyuncs.com/favicon.png!ace" />
</div>
</div>
</body>
</html>