前端之清除浮动的方式
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> .outer{ background-color: #f40; } .item{ width: 180px; height: 150px; background-color: #303a40; border: 1px solid red; } .left{ float: left; } .clearfix:after{ content: "clear"; clear: both; display: block; visibility: hidden; height: 0; } </style> </head> <body> <div class="outer clearfix"> <div class="item left"></div> <div class="item left"></div> <div class="item left"></div> <div class="item left"></div> <div class="item left"></div> <div class="item left"></div> <!--<div id="" style="clear: both;"></div>--> </div> </body> </html>