Flex-box: Align last row to grid

后端 未结 29 2533
不知归路
不知归路 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:22

    This is a combination of a lot of the answers but it does exactly what I was needing -- which is, aligning the last child in a flex container to the left while maintaining the space-between behavior (in this case it's a three-column layout).

    Here's the markup:

    .flex-container {
      display: flex;
      justify-content: space-between;
      flex-direction: row;
    }
    
    .flex-container:after {
      content: "";
      flex-basis: 30%;
    }
    

提交回复
热议问题