How do I use “flex-flow: column wrap”?

后端 未结 3 1687
忘了有多久
忘了有多久 2021-02-01 12:44

Short version

When using flex-flow: column wrap and display: inline-flex, it doesn\'t shrinkwrap like inline-block:

3条回答
  •  没有蜡笔的小新
    2021-02-01 13:34

    If you don't know the height of each item or how many items you will have, a more flexible solution is this:

    .parent {
      column-count: 4
    }
    .child {
      display: inline-block;
      width: 100%;
    }
    

    https://developer.mozilla.org/en-US/docs/Web/CSS/column-count

    You may also need to adjust margin-top of .child:first-child if they don't align to the top.

提交回复
热议问题