一、案例
1.弹性容器案例
<style>
.son {
width: 60px;
height: 60px;
border: 1px solid red;
margin: 5px;
box-sizing: border-box;
background-color: blanchedalmond;
}
.flex-direction,.align-content,.align-items, .flex-wrap,.flex-flow,.justify-content{
width: 600px;
display: flex;
background-color: gray;
margin: 10px auto;
}
.flex-direction {
flex-direction: row;
}
.flex-wrap {
flex-wrap: nowrap;
}
.flex-flow {
flex-flow: row wrap-reverse;
}
.justify-content {
height: 100px;
justify-content: space-around;
}
.align-items {
height: 100px;
flex-flow: row wrap;
align-items: baseline;
}
.align-content {
height: 300px;
flex-flow: row wrap;
align-content: stretch;
}
</style>
<body>
<!-- flex-direction -->
<div class="flex-direction">
<div class="son">老大</div>
<div class="son">老二</div>
<div class="son">老三</div>
<div class="son">老四</div>
<div class="son">老五</div>
</div>
<!--省略其他div-->
</body>
2.弹性元素案例
<style>
.son {
width: 60px;
height: 60px;
border: 1px solid red;
margin: 5px;
box-sizing: border-box;
background-color: blanchedalmond;
}
.order,.flex-grow,.flex-shrink,.flex-basis,.flex,.align-self {
width: 600px;
height: 100px;
display: flex;
margin: 10px auto;
background-color: g