-
Notifications
You must be signed in to change notification settings - Fork 2
/
多列等分布局(float).html
38 lines (36 loc) · 992 Bytes
/
多列等分布局(float).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
<!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">
<link rel="stylesheet" type="text/css" href="../../result/main.css">
<title>多列等分布局(float)</title>
<style>
.parent{
background-color:mediumseagreen;
margin-left:-20px;
/*为了添加这个20px*/
}
.column{
float:left;
width:25%;
padding-left:20px;
box-sizing:border-box;
/*让width包含padding-left,就是把padding-left算到25%内 */
}
p{
background-color:mediumseagreen;
height:300px;
}
</style>
</head>
<body>
<div class="parent">
<div class="column"><p>1</p></div>
<div class="column"><p>2</p></div>
<div class="column"><p>3</p></div>
<div class="column"><p>4</p></div>
</div>
</body>
</html>