webveuje/teaching/wanzhaoyi/flex.html
2021-05-11 11:33:55 +08:00

60 lines
1.5 KiB
HTML

<!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>
*{
margin:0;
padding:0;
}
.box{
border: 1px solid blue;
display:flex;
flex-direction: row;
/* justify-content: space-around; 跟父元素边缘有距离*/
justify-content: space-between; /* 跟父元素边缘没有距离*/
flex-wrap: wrap;
}
.item{
width: 200px;
height: 200px;
background:blue;
}
.item2{
background: red;
}
.item3{
background:pink;
}
.item4{
background: greenyellow;
}
.yuan{
width: 50px;
height: 50px;
background-color: aqua;
border-radius: 50%;
}
</style>
</head>
<body>
<div class="box">
<div class="item"></div>
<div class="item item2"></div>
<div class="item item3"></div>
<div class="item item4"></div>
<div class="item item2"></div>
<div class="item item3"></div>
<div class="item item4"></div>
<div class="item item2"></div>
<div class="item item3"></div>
<div class="item item4"></div>
</div>
<div class="yuan"></div>
</body>
</html>