<!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>
.wrap{
width: 800px;
height: 300px;
background-color: red;
/* 弹性容器 */
display: flex;
/* flex-direction: row-reverse;
flex-wrap: wrap; */
/* 复合写法
flex-flow: flex-direction flex-wrap;
*/
flex-flow: row-reverse wrap;
}
.wrap div{
width: 100px;
height: 100px;
}
.wrap div:nth-child(1){
background-color: pink;
}
.wrap div:nth-child(2){
background-color: green;
}
.wrap div:nth-child(3){
background-color: tomato;
}
.wrap div:nth-child(4){
background-color: yellowgreen;
}
</style>
</head>
<body>
<div class="wrap">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>4</div>
<div>4</div>
<div>4</div>
<div>4</div>
<div>4</div>
</div>
</body>
</html>