清除浮动:
方法一:在浮动元素后面添加一个空元素
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> .box{ width:100px; height:100px; background:#abcdef; float:left; border:1px solid; } .clear{ clear:both; } </style> </head> <body> <div class="wrap"> <div class="box"></div> <div class="box"></div> </div> <div class="clear"></div> <div class="last"> last~ </div> </body> </html>