父元素清除浮动

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <ul class="box">
            <li class="box01">11</li>
            <li class="box02">22</li>
            <li class="box03">33</li>
        </ul>
        
        
        <style type="text/css">
            .box{
                width: 100%;
                height: auto;
                position: relative;
                content: "";
                display: block;
                clear: both;
                zoom: 1 ;
                overflow: auto;
            }
            .box li{
                width: 200px;
                height: 200px;
                text-align: center;
                line-height: 200px;
                font-size: 25px;
                color: #fff;
                margin-right: 15px;
                float: left;
            }
            .box .box01{
                background-color: #2985EA;
            }
            .box .box02{
                background-color:#C25251;
            }
            .box .box03{
                background-color: #232325;
            }            
        </style>
    </body>
</html>

 

posted @ 2017-08-17 17:59  生如逆旅,一苇以航  阅读(144)  评论(0编辑  收藏  举报