-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbfc.html
36 lines (34 loc) · 938 Bytes
/
bfc.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
<!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>Document</title>
<style>
*{margin: 0;padding: 0;}
.box1{
width: 100px;
height: 100px;
background: red;
margin-bottom: 10px;
}
.box2{
width: 100px;
height: 100px;
background: yellow;
margin-top: 10px;
}
</style>
</head>
<body>
<!-- https://juejin.im/post/5909db2fda2f60005d2093db -->
<!-- <div class="box1"></div>
<div class="box2"></div> 此时margin的值是10px, 不上20px -->
<!-- ---------------- -->
<div class="box1"></div>
<div class="text"> .text{overflow:hidden}
<div class="box2"></div> 套一层div
</div>
</body>
</html>