Bootstrap 4 .card-text class

BootstrapWeb DevelopmentCSS Framework

Use the card-text class in Bootstrap to set text in a card. Add this class in your web page  by including it as any other class in an element, for example, <p> tag in the below given code snippet −

<p class="card-text">
  Demo text in a card
</p>

The text in the card is added inside the <card> class using the card-text class −

<div class="card">
  <div class="card-body">
    <h4 class="card-title">Demo Title</h4>
    <p class="card-text">Demo text in a card</p>
  </div>
</div>

You can try to run the following code to implement the card-text 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>Demo</h2>
  <div class="card">
    <div class="card-body">
      <h4 class="card-title">Demo Title</h4>
      <p class="card-text">Demo text in a card</p>
   </div>
  </div>
</div>

</body>
</html>
raja
Published on 09-Jul-2018 08:14:48
Advertisements