<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>align-content</title>
<style type="text/css">
.flex-container {
/*
*/
width: 400px;
height: 800px;
background-color: orange;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
/*align-content: center;*/
/*align-content: space-around;*/ /* 子项在交叉轴平分剩余空间 */
align-content: space-between; /* 元素先分布两头, 之后再平分剩余空间 */
}
.flex-item {
width: 100px;
height: 100px;
background-color: pink;
margin: 0 10px;
/*margin-bottom: 15px;*/
}
</style>
</head>
<body>
<div class="flex-container">
<div class="flex-item">1</div>
<div class="flex-item">2</div>
<div class="flex-item">3</div>
<div class="flex-item">4</div>
<div class="flex-item">5</div>
<div class="flex-item">6</div>
<div class="flex-item">7</div>
<div class="flex-item">8</div>
</div>
</body>
</html>
上述运行结果: