Program:
Output:
<!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>sizing in Bootstrap4</title> </head> <body> <nav class="navbar navbar-expand-sm navbar-dark bg-success"> <a class="navbar-brand" href="#">Sizing 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#########################--> <!-- WIDTH CLASSES --> <div class="bg-success p-2 text-white m-1 w-25">Width 25%</div> <div class="bg-success p-2 text-white m-1 w-50">Width 50%</div> <div class="bg-success p-2 text-white m-1 w-75">Width 75%</div> <div class="bg-success p-2 text-white m-1 w-100">Width 100%</div> <br><br> <!-- HEIGHT CLASSES (d-inline-block)--> <div style="height:300px;border:1px solid #333;"> <div class="bg-warning text-white p-3 d-inline-block h-25">Height 25%</div> <div class="bg-warning text-white p-3 d-inline-block h-50">Height 50%</div> <div class="bg-warning text-white p-3 d-inline-block h-75">Height 75%</div> <div class="bg-warning text-white p-3 d-inline-block h-100">Height 100%</div> </div> </div><!-- ./container --> <div style="margin-top:500px;"></div> </body> </html>
Output: