Equal height rows in a flex container

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

    for same height you should chage your css "display" Properties. For more detail see given example.

    .list{
      display: table;
      flex-wrap: wrap;
      max-width: 500px;
    }
    
    .list-item{
      background-color: #ccc;
      display: table-cell;
      padding: 0.5em;
      width: 25%;
      margin-right: 1%;
      margin-bottom: 20px;
    }
    .list-content{
      width: 100%;
    }
    • box 1

      Lorem ipsum dolor sit amet, consectetur adipisicing elit.

    • box 2

      Lorem ipsum dolor sit amet, consectetur adipisicing elit.

    • box 2

      Lorem ipsum dolor

    • box 2

      Lorem ipsum dolor

    • h1

提交回复
热议问题