BFC

作者: shangyunsi | 来源:发表于2018-07-01 13:25 被阅读0次

    BFC(Box Formatting Context)

    Body 根元素
    Display 为 table、flex、inline-box
    overflow 不为visible
    Float 不为none
    Position 为absolute、fixed

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style>
            .container-1{
                padding-left:300px;
                background:cadetblue;
                overflow: hidden;
            }
    
            .container-1 .left{
                float: left;
                width:300px;
                margin-left:-300px;
                background:burlywood;
                height: 200px;
            }
    
            .container-1 .right{
                background:aliceblue;
            }
    
        </style>
    </head>
    <body>
        <div class="container-1">
            <div class="left">left</div>
            <div class="right">right</div>
        </div>
    </body>
    </html>
    

    相关文章

      网友评论

          本文标题:BFC

          本文链接:https://www.haomeiwen.com/subject/eqecuftx.html