<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box{
width: 500px;
height: 500px;
border:2px solid black;
margin:100px auto;
display: flex;
flex-direction: column;
/* 弹性盒 */
/* 调整主轴对齐方向
flex-start
flex-end
center
space-between 两端对齐
space-around 距离环绕
*/
justify-content: center;
align-items: flex-end;
/* 调整侧轴
flex-start
flex-end
center
*/
}
.box div{
width: 100px;
height: 100px;
border:1px dashed red;
}
</style>
</head>
<body>
<!-- 弹性盒是一种新的布局方式, 特别适合移动端布局 -->
<div class="box">
<div>1111</div>
<div>2222</div>
<div>3333</div>
<div>4444</div>
</div>
</body>
</html>
CSS 弹性盒主轴对齐方式
最新推荐文章于 2024-03-01 16:21:24 发布