CSS3 flexbox layout max 3 child items on one line

后端 未结 6 1019
余生分开走
余生分开走 2021-02-07 03:05

Is their an simple way in CSS to have a fixed maximum of child items on the same line, before you push the next child elements to a new line?

6条回答
  •  失恋的感觉
    2021-02-07 03:56

    Use flex-basis.

    .child {
    flex-basis: 33%;
    }
    

    The percentage must be adapted according to you box-sizing model, and the use of margins and/or padding.

提交回复
热议问题