美文网首页
flex之网页的伸缩布局小案例

flex之网页的伸缩布局小案例

作者: 小透明进击战 | 来源:发表于2019-06-27 21:03 被阅读0次
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            * {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
            }
            .box {
                height: 700px;
                width: 500px;
                display: flex;
                background-color: #eeeeee;
                margin: 100px auto;
                /*主轴默认为row,所以要改变主轴*/
                flex-direction: column;
    
            }
            header {
                width: 100%;
                height: 50px;
                background-color: pink;
            }
            footer {
                width: 100%;
                height: 50px;
                background-color: hotpink;
            }
            main {
                width: 100%;
    
                background-color: lightgreen;
                flex: 1;
                display: flex;
            }
            main > article {
    
                height: 100%;
                flex: 1;
                background-color: cornflowerblue;
            }
            main > aside {
    
                height: 100%;
                flex: 3;
                background-color: greenyellow;
            }
    
    
        </style>
    </head>
    <body>
    <div class="box">
        <header></header>
        <main>
            <article></article>
            <aside></aside>
        </main>
        <footer></footer>
    
    </div>
    
    </body>
    </html>
    

    相关文章

      网友评论

          本文标题:flex之网页的伸缩布局小案例

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