CSS浮动
传统网页布局的三种方式
浮动案例

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
*{
margin: 0px;
padding: 0px;
}
.box{
width: 1200px;
height: 460px;
background-color: gray;
margin: 0 auto;
}
.left{
float: left;
width: 230px;
height: 460px;
background-color: aqua;
}
.right{
width: 970px;
height: 460px;
background-color: antiquewhite;
float: left;
}
.box1{
width: 1226px;
height: 285px;
background-color: #808080;
margin: 0 auto;
}
.box1 li{
width: 296px;
height: 285px;
background-color: purple;
float: left;
}
</style>
</head>
<body>
<div class="box">
<div class="left">left</div>
<div class="right">right</div>
</div>
<ol class="box1">
<li></li>
<li></li>
<li></li>
<li></li>
</ol>
</body>
</html>
清除浮动
- 总结
额外标签法 |
通俗易懂,书写方便 |
添加去多无意义的标签 |
父级overflow:hidden; |
书写简单 |
溢出隐藏 |
父级:after伪元素 |
结构语义化正确 |
兼容性问题 |
父级双伪元素 |
结构语义话正确 |
兼容性问题 |
原文链接:http://www.cnblogs.com/SSPOFA/p/11846004.html