Equal height rows in a flex container

前端 未结 9 799
梦如初夏
梦如初夏 2020-11-22 09:28

As you can see, the list-items in the first row have same height. But items in the second row have different height

9条回答
  •  鱼传尺愫
    2020-11-22 09:50

    The answer is NO.

    The reason is provided in the flexbox specification:

    6. Flex Lines

    In a multi-line flex container, the cross size of each line is the minimum size necessary to contain the flex items on the line.

    In other words, when there are multiple lines in a row-based flex container, the height of each line (the "cross size") is the minimum height necessary to contain the flex items on the line.

    Equal height rows, however, are possible in CSS Grid Layout:

    • Equal height rows in CSS Grid Layout

    Otherwise, consider a JavaScript alternative.

提交回复
热议问题