display:flex; flex-wrap:wrap后,元素上下有边距 .classname{ display:flex; flex-wrap:wrap; align-content:flex-start;//添加这一行即可 }