You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

37 lines
1.1 KiB

<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>
#div0 {
width: 380px;
background-color: blue;
display: flex;
/* 主轴为 row ,横向排列;主轴为 column,纵向排列 */
flex-flow: row wrap;
justify-content: space-between;
/* align-items 是设置每个 flex 元素在交叉轴上的默认方式,控制单行的效果 */
/* align-items: center; */
/* align-content 也是设置每个 flex 元素在交叉轴上的默认方式,但是是控制多行的效果 */
align-content: center;
height: 400px;
}
#div0 div {
width: 100px;
height: 100px;
background-color: aqua;
}
</style>
</head>
<body>
<div id="div0">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
</body>
</html>