用到知识点:
float,块元素居中,注意:(如何让浮动元素和块元素在同一行--display: inline-block失效)
正确布局代码
<body> <div id="left"></div> <div id="right"></div> <div id="middle"></div> </body>
正确CSS
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#left {
height: 500px;
width: 200px;
border:2px solid red;
float: left;
}
#middle {
height: 500px;
margin: 0 220px;
border: 2px solid green;
}
#right {
width: 200px;
height: 500px;
border:2px solid blue;
float: right;
}
错误代码: