flex 佈局 盒子居中顯示

flex 佈局 盒子居中顯示

display: flex;
justify-content: center;
align-items: center;

align-items: center;

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        .box {
            width: 467px;
            height: 377px;
            border: 1px solid red;
            margin: 150px auto;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .one {
            width: 177px;
            height: 177px;
            background-color: red;
        }
    </style>
</head>

<body>

    <div class="box">
        <div class="one"></div>
    </div>
</body>

</html>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章