标签:
清除浮动 : 实现父元素能被浮动元素撑开
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style>
*{margin: 0;padding: 0;}
.test{zoom: 1;}/*ie兼容*/
.test:after{
content: "564654";
display:block;
height: 0;
clear: both;
visibility: hidden;
}
.before-test{zoom: 1;}
.before-test:before{
content: "564654";
display:block;
height: 0;
clear: both;
visibility: hidden;
}
</style>
</head>
<body>
<div class="test" style="border:1px solid red;">
<p style="float: left;height: 100px;border: 1px solid blue;font-size: 14px;">黄金进口的水果科技的反馈结果合法</p>
<p style="float: left;height: 80px;border: 1px solid gray;">xdshgfhgh</p>
<!--<div style="clear: both;"></div>-->
<p class="before-test">sdgfdgfhg</p>
<p>sdgsfhghgfj</p>
</div>
</body>
</html>
标签:
原文地址:http://www.cnblogs.com/rionaBlog/p/5736429.html