问答详情
源自:14-1 弹性盒模型 - 弹性盒模型之flex属性

如何编辑代码成以下样式

http://img3.mukewang.com/5ec504db0001fe7204540340.jpg完整HTML样式

提问者:WuliZhuer 2020-05-20 18:23

个回答

  • weixin_慕仰9011665
    2020-05-22 17:16:16

    多定义几个div,应该可以,全部用一个div,上面和下面都在第一个div里面重新定义不同的div,中间的做一个div,中间的在分成三个div,在细分,就可以了,自己去尝试吧。

  • 慕侠5052482
    2020-05-22 10:41:37

    <!DOCTYPE html>

    <html>

    <head>

    <meta charset="utf-8">

    <title></title>

    <style>

    body{

    }

    .div0{

    margin: 0 auto;

    width: 80%;

    background-color: #ccc;

    }

    .divTop{

    height: 200px;

    background-color: springgreen;

    }

    .divCenter{

    height: 500px;

    background-color: green;

    display: flex;

    }

    .divBottom{

    height: 200px;

    background-color: springgreen;

    }

    .divCLeft{

    flex: 1;

    background-color: yellow;

    }

    .divCCenter{

    flex: 2;

    background-color: orange;

    }

    .divCRight{

    flex: 1;

    background-color: deeppink;

    }

    .divCLeft1{

    height: 100px;

    background-color:red;

    }

    .divCLeft2{

    height: 100px;

    background-color: skyblue;

    }

    .divCLeft3{

    height: 100px;

    background-color: lawngreen;

    }

    .divCLeft4{

    height: 200px;

    background-color: palevioletred;

    }

    </style>

    </head>

    <body>

    <div class="div0">

    <div class="divTop">

    </div>

    <div class="divCenter">

    <div class="divCLeft">

    <div class="divCLeft1">

    </div>

    <div class="divCLeft2">

    </div>

    <div class="divCLeft3">

    </div>

    <div class="divCLeft4">

    </div>

    </div>

    <div class="divCCenter">

    </div>

    <div class="divCRight">

    </div>

    </div>

    <div class="divBottom">

    </div>

    </div>

    </body>

    </html>


  • 慕侠5052482
    2020-05-22 10:40:39

    <!DOCTYPE html>

    <html>

    <head>

    <meta charset="utf-8">

    <title></title>

    <style>

    body{

    }

    .div0{

    margin: 0 auto;

    width: 80%;

    background-color: #ccc;

    }

    .divTop{

    height: 200px;

    background-color: springgreen;

    }

    .divCenter{

    height: 500px;

    background-color: green;

    display: flex;

    }

    .divBottom{

    height: 200px;

    background-color: springgreen;

    }

    .divCLeft{

    flex: 1;

    background-color: yellow;

    }

    .divCCenter{

    flex: 2;

    background-color: orange;

    }

    .divCRight{

    flex: 1;

    background-color: deeppink;

    }

    .divCLeft1{

    height: 100px;

    background-color:red;

    }

    .divCLeft2{

    height: 100px;

    background-color: skyblue;

    }

    .divCLeft3{

    height: 100px;

    background-color: lawngreen;

    }

    .divCLeft4{

    height: 200px;

    background-color: palevioletred;

    }

    </style>

    </head>

    <body>

    <div class="div0">

    <div class="divTop">

    </div>

    <div class="divCenter">

    <div class="divCLeft">

    <div class="divCLeft1">

    </div>

    <div class="divCLeft2">

    </div>

    <div class="divCLeft3">

    </div>

    <div class="divCLeft4">

    </div>

    </div>

    <div class="divCCenter">

    </div>

    <div class="divCRight">

    </div>

    </div>

    <div class="divBottom">

    </div>

    </div>

    </body>

    </html>