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" 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>Cards in Bootstrap4</title> </head> <body> <nav class="navbar navbar-expand-sm navbar-dark bg-success"> <a class="navbar-brand" href="#">Cards 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#########################--> <!-- CARD WITH IMAGE --> <div class="card" style="width:20rem"> <img src="img/card.jpg" class="card-img-top" alt="Card image cap"> <div class="card-body"> <h4 class="card-title">Card Title</h4> <p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illo, quas.</p> <a href="#" class="btn btn-primary">Read More</a> </div> </div> <br><br> <!-- CARD WITH HEADER --> <div class="card" style="width: 20rem;"> <div class="card-header"> Heading </div> <div class="card-body"> <h5 class="card-title"> Title </h5> <p class="card-text"> This is some text</p> </div> </div> <br><br> <!-- HEADER, FOOTER, BODY --> <div class="card" style="width: 20rem;"> <div class="card-body"> <h5 class="card-title"> Title </h5> <p class="card-text"> This is some text</p> </div> <div class="card-footer"> Footer </div> </div> <br><br> <br><br> <!-- IMAGE OVERLAYS card-img , card-img-overlay --> <div class="card bg-dark text-white"> <img class="card-img" src="img/card_img.jpg" style="width: auto; height: 200px"> <div class="card-img-overlay"> <h4 class="card-title">Card title</h4> <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> <p class="card-text"><small>Last updated 3 mins ago</small></p> </div> </div> <br><br> <!-- CARD DECK --> <div class="container"> <div class="card-deck"> <div class="card"> <div class="card-header"> Header </div> <div class="card-body"> <div class="card-title"> Title </div> <div class="card-text"> Some Text </div> </div> </div> </div> </div> <br><br> </div><!-- ./container --> <div style="margin-top:500px;"></div> <!-- BODY ENDS --> </body> </html>
Output: