<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
section {
width: 1000px;
height: 200px;
border:1px solid pink;
margin:100px auto;
display:flex;
max-width:500px;
/* flex-direction:row; */
/* 橫向排列 */
flex-direction:column;
/* 豎向排列 */
}
section div {
/* width:33.33%; */
/*height:100%;*/
float:left;
/* flex:1; */
margin:0 5px;
/* 子盒子添加份數 */
}
section div:nth-child(1) {
background-color: pink;
width: 300px;
/* 子盒子份數 不跟單位*/
}
section div:nth-child(2) {
background-color: green;
width: 100px;
}
section div:nth-child(3) {
background-color: pink;
flex:1;
}
section div:nth-child(4) {
background-color: skyblue;
flex:1;
}
</style>
</head>
<body>
<section>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</section>
</body>
</html>
flex-direction:row //橫向組合排列 (默認水平方向)
row-reverse:對齊方式與row相反 給父盒子添加
flex-direction:column //豎向組合排列
column-reverse:對齊方式與column相反