flex布局

 

flex

  两端对齐,列不满左对齐

  利用after或者before(适用于每行3或者4列)

.box:after {
    display:block;
    content:"";
    width: 30%;
    height:0px;
}
全部代码
.box { display: flex; flex
-wrap: wrap; justify-content: space-between; } .item { width: 30%; height: 50px; background-color: #f1f8ff; margin-bottom: 10px; } .placeholder { width: 30%; height: 0px; } <div class="box"> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="placeholder"></div> </div>

 

posted @ 2021-01-26 11:53  文采呱呱  阅读(84)  评论(0编辑  收藏  举报