Flexbox: 4 items per row

前端 未结 9 1164
南笙
南笙 2020-11-22 13:01

I\'m using a flex box to display 8 items that will dynamically resize with my page. How do I force it to split the items into two rows? (4 per row)?

Here is a releva

9条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 13:19

    Here is another apporach.

    You can accomplish it in this way too:

    .parent{
      display: flex;
      flex-wrap: wrap;
    }
    
    .child{
      width: 25%;
      box-sizing: border-box;
    }
    

    Sample: https://codepen.io/capynet/pen/WOPBBm

    And a more complete sample: https://codepen.io/capynet/pen/JyYaba

提交回复
热议问题