Html5 之弹性布局

编写代码

<!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: 612px;
            /* height: 904px; */
            border: orangered 1px solid;
            /* margin: 0px; */
            display:flex;
            flex-wrap:wrap;
            flex-direction: row;
            justify-content: center;
            align-items: center;
            /* box-sizing:content-box; */
            padding: 1px;
            
            
        }
        .box div{
            
            width: 200px;
            height: 200px;
            background-color: pink;
            border:black 1px solid;
            border-radius: 10px;
            text-align: center;
            line-height: 200px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            box-sizing:content-box;
            margin: 1px;
            

        }
    </style>

</head>
<body>
    <div class="box">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
        <div>7</div>
        <div>8</div>
        <div>9</div>

    </div>

</body>
</html>

运行结果

posted @ 2021-08-15 17:47  阿向向  阅读(158)  评论(0编辑  收藏  举报