<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.flex-container{
width: 600px;
height: 400px;
background-color: aqua;
display: flex;
/* 水平方向 */
/* justify-content: center; */
/* justify-content: end; */
/* 垂直方向 */
/* 适用于对一行子盒子进行操作 */
/* align-items: end; */
/* align-items: center; */
/* 当达到容器宽度时,则会换行 */
flex-wrap: wrap;
/* 适用于对多行子盒子进行操作 */
align-content:space-around ;
/* align-content:space-between ; */
/* align-content: flex-end; */
}
.flex-container div{
border: 5px #ccc solid;
background-color: pink;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<div class="flex-container">
<div class="box1">1</div>
<div class="box1">2</div>
<div class="box1">3</div>
<!-- <div class="box1">4</div>
<div class="box1">5</div>
<div class="box1">6</div> -->
</div>
</body>
</html>
flex布局常用属性
于 2023-09-12 12:34:46 首次发布