CSS 弹性布局 flex 二

居中等分 justify-content:center;
居中对齐(项目 itmes) align-items:center;
布局方向(方向 direction; 行 row; 列 lcoumn) flex-direction:lcoumn;

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Title</title>
    <meta name="Keywords" content="关键字">
    <meta name="description" content="简介">
    <!-- 居中等分justify-content:center;
        居中对齐(项目items) align-items:center;
        布局方向(方向 direction; 行 row; 列 column) flex-direction:column;
     -->
</head>
<body>
<style>
    .box {
        display: flex;
        width: 100%;
        height: 500px;
        background-color: pink;
        /*居中等分 space-around*/
        /*justify-content: space-around;*/
        justify-content: center;
        /*居中对齐 项目(items)*/
        align-items: center;
        /*布局方向(方向 direction;行 row;列 column) flex-direction:row*/
        /*flex-direction: row;*/
    }

    .box span {
        /*flex: 1;*/
        width: 200px;
        height: 150px;
        margin: 5px;
    }
</style>
<div class="box">
    <!-- 对齐 align;自己 self; -->
    <span style="align-self:flex-start;background-color: aqua">11</span>
    <span style="background-color: green">22</span>
    <span style="background-color: lightgreen">44</span>
    <span style="align-self:flex-end;background-color: deepskyblue">33</span>
</div>
</body>
</html>
上一篇:test1


下一篇:粒子背景测试