flex中的flex-direction
程序员文章站
2022-05-30 23:39:36
...
html部分:
<div class="container container1">
<div class="flex-item flex-item1">1 1</div>
<div class="flex-item flex-item2">1 2</div>
<div class="flex-item flex-item3">1 3</div>
</div>
<div class="container container2">
<div class="flex-item flex-item1">2 1</div>
<div class="flex-item flex-item2">2 2</div>
</div>
<div class="container container3">
<div class="flex-item flex-item1">3 1</div>
<div class="flex-item flex-item2">3 2</div>
</div>
<div class="container container4">
<div class="flex-item flex-item1">4 1</div>
<div class="flex-item flex-item2">4 2</div>
<div class="flex-item flex-item3">4 3</div>
</div>
css部分:
.container{width: 440px;height: 240px;background: #DBEFFA;margin: 10px}
.flex-item{background: #BDD8F5;margin: 10px;color: #000;text-align: center;font-size: 14px;}
.container1 .flex-item,.container2 .flex-item,.container3 .flex-item,.container4 .flex-item{line-height: 80px;width: 200px;height:200px;}
.container1{display:flex;flex-flow:row;}
.container2{display:flex;flex-direction:row-reverse;}
.container3{display:inline-flex;flex-direction:column;width:220px;}
.container4{display:inline-flex;flex-direction:column;height: 440px;width:220px;}
代码栗子看这里啦!!
https://jsbin.com/narulabuju/edit?html,css,output