Set less important content with Bootstrap 4 card

BootstrapWeb DevelopmentCSS Framework

To set less important stuff in Bootstrap, use the card class with the bg-secondary contextual class as shown below −

<div class="card bg-secondary text-white">

Set the card body as well using the card-body class −

<div class="card bg-secondary text-white">
  <div class="card-body">Fitness Trackers</div>
</div>

Let us see how to set a card with less important content −

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>Fitness Products</h3>
    <div class="card bg-secondary text-white">
      <div class="card-body">Fitness Trackers</div>
    </div ><br>
    <div class="card bg-secondary text-white">
      <div class="card-body">Heart Rate Monitors</div>
    </div>
  </div>
</body>
</html>
raja
Published on 18-Jul-2018 09:50:46
Advertisements