<!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>

学习微信小程序之css17clearfix原理

相关文章:

  • 2022-02-06
  • 2021-11-05
  • 2021-07-29
  • 2022-01-02
  • 2021-08-04
猜你喜欢
  • 2021-11-18
  • 2021-07-03
  • 2021-10-15
  • 2022-01-01
相关资源
相似解决方案