<style>
.parent{
height: 300px;
border: 1px solid red;
display: flex;
flex-direction: row;/*行排列*/
/*flex-direction: row-reverse;
flex-direction: column;
flex-direction: row-column;*//*列排列*/
flex-wrap: wrap;/*设置换行*/
}
.child{
background-color: yellow;
/*margin: 20px;*/
flex: 200px 1;/*设置占满父元素的剩余空间*/
}
.child:nth-child(odd){
background-color: blue;
/*flex: 2;*/
}
</style>
<div class="parent">
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
</div>