在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>clearfix原理</title> <style> *{ padding:0; margin: 0; } .header,.aside,.main,.footer{ border: 1px solid yellow; background-color: silver; margin-bottom: 10px; height: 200px; } .aside{ height: 300px; float: left; width: 200px; } .main{ float: left; width: 980px; /*margin-left: 202px;*/ } .clerafix{ display: table;/* 触发bfc,让div具有包裹性*/ } .clerafix:before,.clerafix:after{ content: ""; display:block; clear: both; height: 0px; } /* 在IE6触发bfc,让div具有包裹性*/ /*.clerafix{*/ /*zoom: 1;*/ /*}*/ </style> </head> <body> <div class="header"> header </div> <div class="wrap clerafix"> <div class="aside"> aside </div> <div class="main"> main </div> </div> <div class="footer"> foot </div> </body> </html> |
请发表评论