flex布局入门


<!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>
        div {
            height: 800px;
            display: flex;
            /* 指定主轴为y */
            flex-direction: column;
            /* 指定沿着主轴的排列方式 */
            /*两侧盒子靠边后平均分配 space-between
            元素靠右flex-end
            */
            justify-content: center;
            /* 设置自动换行 */
            flex-wrap: wrap;
            /* 设置侧轴排列 */
            align-items: center;
            /* 设置侧轴排列(有多行元素才生效) */
            align-content: space-between;


        }


        span {
            width: 200px;
            height: 200px;


            background-color: aquamarine;
        }
    </style>


</head>


<body>
    <div><span></span><span></span><span>


        </span><span></span><span></span><span></span><span></span></div>



</body>


</html>
posted @ 2021-06-27 09:07  贾正直  阅读(38)  评论(0)    收藏  举报