-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclearfix.html
More file actions
41 lines (41 loc) · 1.1 KB
/
clearfix.html
File metadata and controls
41 lines (41 loc) · 1.1 KB
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Clear fix Demo</title>
<style type="text/css">
.box {
width: 600px;
border: 1px solid black;
}
.floatbox {
float: left;
width: 280px;
height: 280px;
border: 1px solid red;
}
/* clearfix style */
.clearfix:after {
content:" ";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.clearfix {
*zoom: 1;
/* IE6, IE7 hack */
}
</style>
</head>
<body>
<p>在加入clearfix样式之后,box的div被撑开了
</p>
<div class="box clearfix">
<div class="floatbox">float box 1</div>
<div class="floatbox">float box 2</div>
<div class="floatbox">float box 3</div>
<div class="floatbox">float box 4</div>
<div class="floatbox">float box 5</div>
</div>
</body>
</html>