7 Program to show Margin and Padding 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">



    <title>Spacing in Bootstrap4</title>

</head>



<body>



    <nav class="navbar navbar-expand-sm navbar-dark bg-success">

        <a class="navbar-brand" href="#">Spacing 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#########################-->



        <!-- MB MARGIN BOTTOM -->

        <h1 class="bg-success mb-0">Lorem ipsum.</h1>

        <h1 class="bg-success mb-1">Lorem ipsum.</h1>

        <h1 class="bg-success mb-2">Lorem ipsum.</h1>

        <h1 class="bg-success mb-3">Lorem ipsum.</h1>

        <h1 class="bg-success mb-4">Lorem ipsum.</h1>

        <h1 class="bg-success mb-5">Lorem ipsum.</h1>



        <br><br>



        <!-- MT MARGIN TOP -->

        <h1 class="bg-success mt-0">Lorem ipsum.</h1>

        <h1 class="bg-success mt-1">Lorem ipsum.</h1>

        <h1 class="bg-success mt-2">Lorem ipsum.</h1>

        <h1 class="bg-success mt-3">Lorem ipsum.</h1>

        <h1 class="bg-success mt-4">Lorem ipsum.</h1>

        <h1 class="bg-success mt-5">Lorem ipsum.</h1>



        <br><br>



        <!-- BLANK - ALL SIDES -->

        <p>Lorem ipsum dolor sit amet, consectetur elit. Voluptatum, optio.</p>

        <p class="bg-success m-5">Lorem ipsum dolor sit amet, consectetur elit. Voluptatum, optio.</p>

        <p>Lorem ipsum dolor sit amet, consectetur elit. Voluptatum, optio.</p>



        <br><br>



        <!-- PB PADDING BOTTOM -->

        <h1 class="bg-warning pb-0">Lorem ipsum.</h1>

        <h1 class="bg-warning pb-1">Lorem ipsum.</h1>

        <h1 class="bg-warning pb-2">Lorem ipsum.</h1>

        <h1 class="bg-warning pb-3">Lorem ipsum.</h1>

        <h1 class="bg-warning pb-4">Lorem ipsum.</h1>

        <h1 class="bg-warning pb-5">Lorem ipsum.</h1>



        <br><br>



        <!-- PT PADDING TOP -->

        <h1 class="bg-warning pt-0">Lorem ipsum.</h1>

        <h1 class="bg-warning pt-1">Lorem ipsum.</h1>

        <h1 class="bg-warning pt-2">Lorem ipsum.</h1>

        <h1 class="bg-warning pt-3">Lorem ipsum.</h1>

        <h1 class="bg-warning pt-4">Lorem ipsum.</h1>

        <h1 class="bg-warning pt-5">Lorem ipsum.</h1>



        <!-- BLANK - ALL SIDES -->

        <p class="bg-warning p-5">Lorem ipsum dolor sit amet, consectetur elit. Voluptatum, optio.</p>



    </div><!-- ./container -->

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



    <!-- BODY ENDS -->

    <script src="bootstrap/js/jquery-3.3.1.min.js"></script>

    <script src="bootstrap/js/popper.min.js"></script>

    <script src="bootstrap/js/bootstrap.min.js"></script>

    <script src="bootstrap/js/mdb.min.js"></script>

</body>



</html>


Output:

Margin and Padding in BootStrap

Previous
Next Post »