Bootstrap 4 .card-img-bottom class


Use the card-img-bottom class in Bootstrap 4 to place an image at the bottom inside a Bootstrap 4 card.

Set the card body, and within that, the card title and card text −

<div class="card-body">
  <h4 class="card-title">Quantitative Aptitude</h4>
  <p class="card-text">For Entrance Exams</p>
  <a href="#" class="btn btn-primary">Sample Questions</a>
</div>

Now set image with class “card-img-bottom”−

<img class="card-img-bottom" src="Image-Source" alt="alt text" style="width:100%">

Let us see an example to learn how to implement Bootstrap 4 .card-img-bottom class −

Example

Live Demo

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  </head>
<body>
  <div class="container">
    <h3>Quantitative Aptitude Questions Answers</h3>
    <div class="card" style="width:400px">
      <div class="card-body">
        <h4 class="card-title">Quantitative Aptitude</h4>
        <p class="card-text">For Entrance Exams</p>
        <a href="#" class="btn btn-primary">Sample Questions</a>
      </div>
      <img class="card-img-bottom" src="https://www.tutorialspoint.com/videotutorials/images/numerical_ability_home.jpg" alt="QA" style="width:100%">
    </div>
  </div>
 </body>
</html>

Updated on: 17-Jun-2020

342 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements