Flex-box: Align last row to grid

后端 未结 29 2493
不知归路
不知归路 2020-11-22 02:54

I have a simple flex-box layout with a container like:

.grid {
  display: flex;
  flex-flow: row wrap;
  justify-content: space-between;
}

29条回答
  •  不知归路
    2020-11-22 03:09

    Without any extra markup, just adding ::after worked for me specifying the width of the column.

    .grid {
      display:flex;
      justify-content:space-between;
      flex-wrap:wrap;
    }
    .grid::after{
      content: '';
      width: 10em // Same width of .grid__element
    }
    .grid__element{
      width:10em;
    }
    

    With the HTML like this:

提交回复
热议问题