小编use*_*659的帖子

flex-flow:列换行不会拉伸父元素的宽度

当我使用时flex-flow: column wrap,父元素的宽度不会被拉伸。

现在

预计

*{
            margin: 0;
            padding: 0;
        }
        .box{
            background: #f03;
            position: relative;
            display: inline-block;
            /* top:10px; */
            /* left: 10px; */
            padding: 20px;
        }
        .in{
            display: flex;
            align-items: center;
            flex-flow: column wrap;
            max-height: 300px; 
            align-content: flex-start;
            justify-content: space-between;

        }
        .item{
            background: #fe3;
            width: 100px;
            margin-bottom: 20px;
            height: 100px;

        }
        .item:last-child{
            margin-left: 15px;
        }
    <body>
     <div class="box">
         <div class="in">
             <div class="item">1</div>
             <div class="item">2</div>
             <div class="item">3</div>
         </div>
     </div>
</body>
Run Code Online (Sandbox Code Playgroud)

https://jsfiddle.net/p4oLk7dz/5/


所以我该怎么做?

html css flexbox

5
推荐指数
1
解决办法
3649
查看次数

标签 统计

css ×1

flexbox ×1

html ×1