Equal height rows in a flex container

前端 未结 9 705
梦如初夏
梦如初夏 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:51

    This seems to be working in cases with fixed parent height (tested in Chrome and Firefox):

    .child {
            height    : 100%;
            overflow  : hidden;
    }
    
    .parent {
            display: flex;
            flex-direction: column;
            height: 70vh; // ! won't work unless parent container height is set
            position: relative;
    }
    

    If it's not possible to use grids for some reason, maybe it's the solution.

提交回复
热议问题