flex布局设置space-between(around)最后一行不左对齐问题
需求在项目布局上使用弹性布局,要求每个盒子两端要对齐,而且最后一行在列不满的情况下要求左对齐;
问题: 使用flex的设置justify-content为space-between;发现最后一行不能左对齐,而是两端对齐方式导致形成下图,
方法:
一、添加几个空格子,格子高度为0
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>flex弹性布局</title>
<style>
.container {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.box {
width: 300px;
height: 100px;
background-color: red;
margin-bottom: 10px;
}
.item-empty {
height: 0px;
width: 300px;
}
</style>
</head>
<body>
<div class