
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
* {
padding: 0;
margin: 0;
}
.wrap {
width: 960px;
border: 1px solid #ccc;
margin: 5px auto;
text-align: center;
}
.wrap .hd {
height: 50px;
border: 1px solid #ccc;
background-color: #EE82EE;
font: 16px/1.5 "微软雅黑";
opacity: .8;
/*设置模糊度*/
}
/*加入弹性盒子*/
.wrap .bd {
display: flex;
}
.wrap .bd .child {
width: 100px;
height: 100px;
border: 3px solid #333333;
background-color: #7FFFD4;
/*padding-top: 15px;*/
}
.row {
flex-direction: row;
}
.row-reverse {
flex-direction: row-reverse;
}
.column {
flex-direction: column;
}
.column-reverse {
flex-direction: column-reverse;
}
.flex-wrap {
flex-wrap: wrap;
}
.flex-nowrap {
flex-wrap: nowrap;
}
.flex-wrap-reverse {
flex-wrap: wrap-reverse;
}
/*=======设置父盒子的 子元素的排列间隙==========*/
.justify-content-flex-start {
justify-content: flex-start;
/*默认左对齐*/
}
.justify-content-flex-end {
justify-content: flex-end;
/*右对齐*/
}
.justify-content-center {
justify-content: center;
/*居中对齐*/
}
.justify-content-space-around {
justify-content: space-around;
/* 每个项目两侧间隔相等 */
}
.justify-content-space-between {
justify-content: space-between;
/* 两端对齐*/
}
/*=========设置父盒子侧轴 子元素对齐方式=========*/
.align-items-flex-start {
align-items: flex-start;
/* 顶部对齐*/
}
.align-items-flex-end {
align-items: flex-end;
/* 底部对齐*/
}
.align-items-center {
align-items: center;
/* 中心对齐*/
}
.align-items-baseline {
align-items: baseline;
/* 中心对齐*/
}
.align-items-stretch {
align-items: stretch;
/* 中心对齐*/
}
/*S=>设置父盒子 多行子元素垂直对齐方式*/
.align-content-flex-start{
align-content: flex-start;
}
.align-content-flex-end{
align-content: flex-end;
}
.align-content-center{
align-content:center;
}
.align-content-space-between{
align-content: space-between;
}
.align-content-space-around{
align-content: space-around;
}
.align-content-sstretch{
align-content: stretch;
}
/*E=>设置父盒子 多行子元素垂直对齐方式*/
</style>
</head>
<body>
<h3>5、多行子元素的对齐方式</h3>
<hr />
<div class="wrap">
<div class="hd">
多行子元素的对齐方式 align-content: sstretch;
</div>
<div class="bd row flex-wrap align-content-stretch" >
<!--默认的都是0
可以随意的排序,不受父盒子的影响 order
-->
<div class="child"style=""> 1</div>
<div class="child" style="order: 1;">2</div>
<div class="child">3</div>
<div class="child">4</div>
<div class="child">5</div>
</div>
</div>
</body>




<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
* {
padding: 0;
margin: 0;
}
.wrap {
width: 960px;
border: 1px solid #ccc;
margin: 5px auto;
text-align: center;
}
.wrap .hd {
height: 50px;
border: 1px solid #ccc;
background-color: #EE82EE;
font: 16px/1.5 "微软雅黑";
opacity: .8;
/*设置模糊度*/
}
/*加入弹性盒子*/
.wrap .bd {
display: flex;
}
.wrap .bd .child {
width: 100px;
height: 100px;
border: 3px solid #333333;
background-color: #7FFFD4;
/*padding-top: 15px;*/
}
.row {
flex-direction: row;
}
.row-reverse {
flex-direction: row-reverse;
}
.column {
flex-direction: column;
}
.column-reverse {
flex-direction: column-reverse;
}
.flex-wrap {
flex-wrap: wrap;
}
.flex-nowrap {
flex-wrap: nowrap;
}
.flex-wrap-reverse {
flex-wrap: wrap-reverse;
}
/*=======设置父盒子的 子元素的排列间隙==========*/
.justify-content-flex-start {
justify-content: flex-start;
/*默认左对齐*/
}
.justify-content-flex-end {
justify-content: flex-end;
/*右对齐*/
}
.justify-content-center {
justify-content: center;
/*居中对齐*/
}
.justify-content-space-around {
justify-content: space-around;
/* 每个项目两侧间隔相等 */
}
.justify-content-space-between {
justify-content: space-between;
/* 两端对齐*/
}
/*=========设置父盒子侧轴 子元素对齐方式=========*/
.align-items-flex-start {
align-items: flex-start;
/* 顶部对齐*/
}
.align-items-flex-end {
align-items: flex-end;
/* 底部对齐*/
}
.align-items-center {
align-items: center;
/* 中心对齐*/
}
.align-items-baseline {
align-items: baseline;
/* 中心对齐*/
}
.align-items-stretch {
align-items: stretch;
/* 中心对齐*/
}
/*S=>设置父盒子 多行子元素垂直对齐方式*/
.align-content-flex-start {
align-content: flex-start;
}
.align-content-flex-end {
align-content: flex-end;
}
.align-content-center {
align-content: center;
}
.align-content-space-between {
align-content: space-between;
}
.align-content-space-around {
align-content: space-around;
}
.align-content-sstretch {
align-content: stretch;
}
/*E=>设置父盒子 多行子元素垂直对齐方式*/
</style>
</head>
<body>
<div class="wrap">
<h3>1.设置盒子的放大比例</h3>
<hr />
<div class="hd">
设置盒子的放大比例 flex-grow
</div>
<div class="bd row flex-wrap align-content-stretch">
<!--若盒子没有铺满,则按照放大的比例进行填充 铺满则不按照比例放大-->
<div class="child" style="flex-grow: 4;"> 1</div>
<div class="child" style="flex-grow: 2;">2</div>
<div class="child" style="flex-grow: 1;">3</div>
</div>
<h3>2.设置盒子的缩小比例</h3>
<hr />
<div class="hd">
设置盒子的缩小比例 flex-shrink
</div>
<div class="bd row align-content-stretch">
<!--若盒子放不下,则按照缩小的比例进行填充 没有铺满则不按照比例缩小
默认为0
-->
<div class="child" style="flex-shrink: 4;"> 1</div>
<div class="child" style="flex-shrink: 2;">2</div>
<div class="child" style="flex-shrink: 1;">3</div>
<div class="child" style="flex-shrink: 1">1</div>
<div class="child" style="flex-shrink:1">2</div>
<div class="child" style="flex-shrink:1">3</div>
<div class="child" style="flex-shrink:1">4</div>
<div class="child" style="flex-shrink:11">5</div>
<div class="child" style="flex-shrink:1">6</div>
<div class="child" style="flex-shrink:1">7</div>
<div class="child" style="flex-shrink:1">8</div>
<div class="child" style="flex-shrink:1">9</div>
</div>
</div>
</body>

