Bootstrap 4 .card-subtitle class

BootstrapWeb DevelopmentCSS Framework

Use the card-subtitle class to set subtitle for the card.

The card-subtitle class is used as shown below −

<h4 class="card-title">Sports</h4>

Here, I have set the subtitle as “Indoor” for an example. The subtitle class comes after the card-title Bootstrap class −

<div class="card-body">
  <h4 class="card-title">Sports</h4>
  <h6 class="card-subtitle text-muted">Indoor</h6>
  <p class="card-text">Squash, Dart, Chess</p>
</div>

Let us see the example to work with card-subtitle class in Bootstrap 4 −

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>Indoor and Outdoor Sports</h3>
    <div class="card">
      <div class="card-body">
        <h4 class="card-title">Sports</h4>
        <h6 class="card-subtitle text-muted">Indoor</h6>
        <p class="card-text">Squash, Dart, Chess</p>
      </div>  
      <div class="card-body">
        <h4 class="card-title">Sports</h4>
        <h6 class="card-subtitle text-muted">Outdoor</h6>
        <p class="card-text">Cricket, Football, Hockey</p>
      </div>
     </div>
   </div>
</body>
</html>
raja
Published on 18-Jul-2018 13:11:19
Advertisements