好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

CSS清除浮动(float)的六种方法

html

    <p>
        <p class='box-left'></p>
        <p class='box-right'></p>
    </p> 

css

    .box-left,.box-right{
        width:200px;
        height:200px;        float: left;
        background: red;
        border:1px solid #333;
    } 

第一种方法:.box{clear:box}

第二种方法:.box{overflow:hidden}

第三种方法:.box{overflow:auto}

第四种方法:.box:after{ content:""; height:0; visibility:hidden; display:block; clear:both;} .box{ zoom:1;}

第五种 方法:.box{height:200px}设置高度

第六种方法:.box{display:table}

还有什么方法欢迎补充,加油,共同进步

以上就是CSS清除浮动(float)的六种方法 的详细内容,更多请关注Gxl网其它相关文章!

查看更多关于CSS清除浮动(float)的六种方法的详细内容...

  阅读:45次