card-title class in Bootstrap 4

BootstrapWeb DevelopmentCSS Framework

Use the card-title class in Bootstrap 4 to set title for the card like the following example −

The card title set above used the card-title class inside the card-body class. In addition, I have used the card-text class to set text inside the Bootstrap card as shown in the below give code snippet −

<div class="card-body">
  <h4 class="card-title">Company Locations</h4>
  <p class="card-text">Singapore</p>
  <p class="card-text">Malaysia</p>
  <p class="card-text">Australia</p>
</div>

You can try to run the following code to implement the card-title class −

Example

Live Demo

<!DOCTYPE html>
<html>
  <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">
  <h2>Location</h2>
  <div class="card">
    <div class="card-body">
      <h4 class="card-title">Company Locations</h4>
      <p class="card-text">Singapore</p>
      <p class="card-text">Malaysia</p>
      <p class="card-text">Australia</p>
    </div>
  </div>
</div>

</body>
</html>
raja
Published on 09-Jul-2018 19:31:53
Advertisements