最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Tiling and row sizing in Bootstrap 5 using the grid system - Stack Overflow

programmeradmin2浏览0评论

I am trying to recreate the attached screenshot using Bootstrap. Unfortunately I'm struggling with the grid system, mostly with the row height and with the actual tiling of it all.

I would either like help fixing my code, or someone to point me in the right direction to find the answer myself.

Here is the code that I have already written:

complex grid pattern I'm trying to replicate

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Bootstrap Grid Layout</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <style>
        .bg-purple{background-color:
            purple;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col-12 bg-primary text-white text-center p-2">a</div>
        </div>
        <div class="row">
            <div class="col-3">
                <div class="row">
                    <div class="col-12 bg-warning text-center p-3">b</div>
                </div>
                <div class="row">
                    <div class="col-12 bg-success text-center p-5">c</div>
                </div>
            </div>
            <div class="col-9">
                <div class="row">
                    <div class="col-8 bg-success text-center p-4">d</div>
                    <div class="col-4 bg-primary text-white text-center p-2">h</div>
                </div>
                <div class="row">
                    <div class="col-8 bg-danger text-white text-center p-5">e</div>
                    <div class="col-4 bg-purple text-white text-center p-3">i</div>
                </div>
                <div class="row">
                    <div class="col-6 bg-purple text-white text-center p-3">f</div>
                    <div class="col-6 bg-warning text-white text-center p-4">g</div>
                </div>
                <div class="row">
                    <div class="col-6 bg-danger text-white text-center p-5">j</div>
                    <div class="col-3 bg-warning text-center p-3">k</div>
                    <div class="col-3 bg-success text-center p-4">l</div>
                </div>
                <div class="row">
                    <div class="col-6 bg-purple text-white text-center p-4">m</div>
                    <div class="col-6 bg-primary text-white text-center p-3">n</div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
发布评论

评论列表(0)

  1. 暂无评论