.zl-list-flex {
display: flex;
display: -o-flex;
display: -ms-flex;
display: -moz-flex;
display: -webkit-flex;
flex-wrap: wrap;
justify-content: space-between;
}
.zl-card {
width: 410px;
height: 416px;
cursor: pointer;
position: relative;
margin-bottom: 70px;
}
当一行只显示4个card,总共有6个card时,第二行会出现两边对齐问题,我们需要把第二行向左对齐。综合研究,暂时没有找到flex布局下css的解决方案。最终采用加margin的float布局。
.zl-list-flex {
margin-right: -54px;
}
.zl-card {
width: 410px;
height: 416px;
float: left;
cursor: pointer;
position: relative;
margin-bottom: 70px;
margin-right: 54px;
}
每行最后一个会出现不必要的margin-right,使用选择器选择nth-child(4n)并不能很好的解决,为容器加上margin-right为负数能够解决这个问题。