日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

使用grid布局解決flex布局最后一行不足的問題

作者:qcc0716 更新時間: 2022-01-08 編程語言
<!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>
        .box1 {
            display: grid;
            justify-content: space-between;
            grid-template-columns: repeat(auto-fill, 100px);
            grid-gap: 10px;
            width: 400px;
            border: 1px solid red;
        }
        .box2 {
            width: 100px;
            height: 100px;
            background-color: skyblue;
            margin-top: 5px;
        }
    </style>
</head>
<body>
    <div class="box1">
        <div class="box2"></div>
        <div class="box2"></div>
        <div class="box2"></div>
        <div class="box2"></div>
        <div class="box2"></div>
        <div class="box2"></div>
        <div class="box2"></div>
    </div>
</body>
</html>

原文鏈接:https://blog.csdn.net/qcc0716/article/details/119667880

欄目分類
最近更新