Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

bootstrap 4 - Can't achieve complicated Boostrap 4 grid

I need to create a bit more complicated bootstrap grid. I've tried many ways but didn't get to what I need. Please find attached a picture of what layout I need. Every color presents a different box I need.

I am using Bootstrap 4.

The grid I need to achieve

question from:https://stackoverflow.com/questions/65848172/cant-achieve-complicated-boostrap-4-grid

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can try this:

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

<head>

    <!-- Required meta tags always come first -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- For Responsive Screens -->
    <meta http-equiv="x-ua-compatible" content="ie=edge">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

</head>

<body>

    <!--The Grid Starts Here-->
    <div class="row" style="height: 500px;">
        <div class="col-7">
            <div class="row" style="height: 350px; background-color: blue;">
                <div class="col-4" style="background-color: white;">
                    <div class="row" style="background-color: orange; height: 100px;">
                    </div>
                    <div class="row" style="background-color: blue; height: 250px;">
                    </div>
                </div>
                <div class="col-8" style="background-color: yellow;">
                </div>
            </div>

            <div class="row" style="height: 150px; background-color: black;">
                <div class="col-6" style="background-color: lightgrey;">
                </div>
                <div class="col-6" style="background-color: red;">
                </div>
            </div>
        </div>
        <div class="col-5" style="background-color: green;"></div>
    </div>
    <!--The Grid Ends Here-->

    <!-- jQuery first, then Popper.js, then Bootstrap JS. -->
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

</body>

</html>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...