1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title></title> 6 <style> 7 body{ 8 margin: 0; 9 } 10 .box{ 11 width: 750px; 12 border: 1px solid #000; 13 overflow: hidden; 14 } 15 .item{ 16 width: 200px; 17 height: 200px; 18 background-color: red; 19 margin-left: 50px; 20 float: left; 21 *display: inline; 22 } 23 </style> 24 <!-- 25 当元素浮动后再设置margin那么就会产生双倍边距 26 解决方案: 27 针对ie6、7添加display:inline 28 --> 29 </head> 30 <body> 31 <div class="box"> 32 <div class="item"></div> 33 <div class="item"></div> 34 <div class="item"></div> 35 </div> 36 </body> 37 </html>