给父盒子css设置了下面样式,发现一层能有相同距离,第二层就靠中间而不是靠左了
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- justify-content: space-around;
所以想第二层的只有1,2个都靠左有相同间距就把父盒子css的justify-content: space-around;去掉给每个子盒子css加上
width:33% ;
display: flex;
justify-content: center;
align-items: center;
就可以了,就是行有几个盒子就用100%除个数,比如我一行要显示5个,那给每个盒子设置20%