让弹性布局的子元素使用伪类 .flowerImgItem:nth-child(3n-1) { margin: 0 .2rem; } .2rem为子元素与子元素之间的间隔; 父元素使用 flex-wrap: wrap;自动换行属性