首页 > 代码库 > 清除浮动3(兼容所有浏览器)

清除浮动3(兼容所有浏览器)

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus?">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>css_盒子</title>
<style type="text/css">
body{border: 1px solid black; }
.box1{border: 1px solid blue;width: 200px;height: 100px;float: left;}
.box2{border: 1px solid red;width: 500px;height: 100px;float: left;}
.clear:after{display: block;clear: both;content: ".";visibility: hidden;height: 0;}
.clear{zoom:"1";}


</style>
</head>
<body>

<div class="box clear">
<div class="box1">我是盒子1</div>
<div class="box2">我是盒子2</div>

</div>
</body>
</html>

清除浮动3(兼容所有浏览器)