css3 - How to align child elements under flex layout?
淡淡烟草味2017-07-04 13:45:08
0
4
1746
As shown in the picture, I use justify-content:space-around;, but I hope that the second row of child elements can be aligned up and down with the first row. The number of child elements is not fixed. How to solve it?
Flex implements layout, mainly because your idea breaks through the convention. If the horizontal layout is unsuccessful, use the vertical axis layout, set it to three columns, each column, flex-direction:colomn; justify-content:space-around; Total Use the three columns again justify-content :space-around;
justify-content:space-between;
You may need some calculations:
View online https://jsfiddle.net/zktf3oc5/
flex
The layout cannot achieve the effect you want when the parent container has a variable width.Flex implements layout, mainly because your idea breaks through the convention. If the horizontal layout is unsuccessful, use the vertical axis layout, set it to three columns, each column,
flex-direction:colomn;
justify-content:space-around;
Total Use the three columns again
justify-content :space-around;