21 Program to demonstrate Grid System in BootStrap

Program:

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css"
        integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
    <!-- CSS only -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
        integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">

    <!-- JS, Popper.js, and jQuery -->
    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
        integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous">
    </script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
        integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous">
    </script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
        integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous">
    </script>
    <title>Grid System in Bootstrap4</title>
</head>

<body>

    <nav class="navbar navbar-expand-sm navbar-dark bg-success">
        <a class="navbar-brand" href="#">Grid System in Bootstrap4</a>
        <button class="navbar-toggler" data-toggle="collapse" data-target="#navbarNav">
            <span class="navbar-toggler-icon"></span>
        </button>
    </nav>

    <div class="container mt-5">
        <!--########################START HERE#########################-->

        <!-- AUTO LAYOUT COLUMNS -->
        <div class="container  border">
            <div class="row bg-info border">
                <div class="col border">
                    1 of 2
                </div>
                <div class="col border">
                    2 of 2
                </div>
            </div>
            <div class="row bg-primary border">
                <div class="col border">
                    1 of 3
                </div>
                <div class="col border">
                    2 of 3
                </div>
                <div class="col border">
                    3 of 3
                </div>
            </div>
        </div>


        <!-- RESPONSIVE CLASSES -->

        <div class="row border mt-5">
            <div class="col bg-primary border">col</div>
            <div class="col bg-secondary border">col</div>
            <div class="col bg-success border">col</div>
            <div class="col bg-danger border">col</div>
        </div>
        <div class="row border">
            <div class="col-8 bg-warning border">col-8</div>
            <div class="col-4 bg-info border">col-4</div>
        </div>

        <!-- NESTING GRIDS -->
        <div class="row border bg-success mt-5">
            <div class="col-sm-9 bg-primary border">
                Level 1: .col-sm-9
                <div class="row ">
                    <div class="col-8 col-sm-6 bg-warning border">
                        Level 2: .col-8 .col-sm-6
                    </div>
                    <div class="col-4 col-sm-6 bg-danger border">
                        Level 2: .col-4 .col-sm-6
                    </div>
                </div>
            </div>
        </div>


    </div>

    <div style="margin-top:500px;"></div>

    <!-- BODY ENDS -->
</body>

</html>


Output:

Grid System in BootStrap

Previous
Next Post »