-
flex-wrap : 决定了flex container是单行显示还是多行显示
-
nowrap 默认: 单行,flex-items多了之后压缩flex-items然后显示在一行
-
wrap:多行 不压缩尺寸直接换行显示
-
flex-flow: flex-direction && flex-wrap缩写
flex-flow: row-reverse wrap;
-
align-content: 决定多行flex-items 在交叉轴 的对齐方式
-
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
#box{
/* 开启flex布局:块元素 */
display: flex;
/* 开启flex布局;行元素 */
/* display: inline-flex; */
background-color: red;
600px;
height: 500px;
/* 水平居中 */
margin: 0 auto;
/* row: 默认值从main start -> main end
row-reverse: 反转 从右到左
column : 从上倒下
column-reverse: 从下到上
*/
/* flex-direction: row-reverse; */
/* flex-start: 默认值 main start对齐
flex-end: main end 对齐
center: 主轴中间对齐
space-between: 左右对齐等分主轴
space-around: 左右等分间隙然后等分
space-evenly: 左右窄,中间等分
*/
/* justify-content: space-around; */
/*
align-items: 决定flex-items在交叉轴的对齐方式
flex-start: 在交叉轴的顶部对齐
flex-end: 在交叉轴的底部对齐
center: 在交叉轴的中心点对齐
baseline: 基线对齐(第一行文本作为基线)
*/
align-items: center;
/* flex-wrap: 决定当flex-items的总宽度/长度 超过flex-contianer 换行显示 */
flex-wrap: wrap;
/* flex-flow : flex-direction && flex-wrap缩写 */
/* flex-flow: row-reverse wrap; */
align-content: center;
}
.item{
text-align: center;
height: 300px;
300px;
}
.item1{
background-color: azure;
}
.item2{
background-color: green;
}
.item3{
background-color: gold;
}
</style>
</head>
<body>
<div id="box">
<div class="item item1">item1</div>
<div class="item item2">item2</div>
<div class="item item3">item3</div>
<!-- <div class="item item4">item4</div> -->
</div>
<strong>行类元素</strong>
</body>
</html>