/
float1.html
77 lines (71 loc) · 1.81 KB
/
float1.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
67
68
69
70
71
72
73
74
75
76
77
<!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>
<style>
*{margin: 0; padding: 0;}
body{background: #ccc;}
header{width: 100%; height: 100px; background: #000;}
main{width: 800px; margin: 10px auto;}
.box1{height: 200px; background: #fff; margin-bottom: 10px;}
</style>
<body>
<header>
header
</header>
<main>
<div class="box1"></div>
<style>
.box2{overflow: hidden;}
.box2 div{height: 100px; background: #fff;
float: left;
width: calc((100% - 20px)/3);
margin-right: 10px;
margin-bottom: 10px;
}
.box2 div:last-child{margin-right: 0;}
</style>
<div class="box2">
<div></div>
<div></div>
<div></div>
</div>
<style>
.box3{overflow: hidden;}
.box3 div{
float: left;
height: 100px; background: #fff;
width: calc((100% - 40px) /5);
margin-right: 10px;
margin-bottom: 10px;
}
.box3 div:last-child{margin-right: 0;}
</style>
<div class="box3">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<style>
.box4{background: #fff; padding: 10px; overflow: hidden;}
.box4 div{float: left;
background: #000;
height: 200px;
width: calc(50% - 5px);}
.box4 div:last-child{float: right;}
</style>
<div class="box4">
<div></div>
<div></div>
</div>
</main>
<footer>
</footer>
</body>
</html>