flex布局 justify-content:space-between;最后一行完美解决方案
1.CSS代码 使用justify-content: flex-start; .home-index-comp-box-list{ height: 100%;width: calc(100% - 250px); display: flex;flex-wrap: wrap;justify-content: flex-start;
}
2.计算每home-index-comp-box-list-unit的宽度
.home-index-comp-box-list-unit{ width: 24.8%;//4个项目 平均25%宽 写成24.8%是为了让中间有空隙 4*24.8=92.6 height: 65%; margin-right: 0.26666%; // (100-92.6)/3=0.26666 }
3.最关键一步 ,修改最后一个home-index-comp-box-list-unit 的margin-right: 0;
.home-index-comp-box-list-unit:nth-of-type(4n){ margin-right: 0; }