CSS3 flexbox layout max 3 child items on one line

后端 未结 6 1021
余生分开走
余生分开走 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:50

    You could place the items inside a container div that has a width of 100% and a max-width that is just enough to fit three items inside it?

    .parent {
        width:100%;
        max-width:350px;
    }
    

    And then place this around all the items.

提交回复
热议问题