Bootstrap 4 .card-header-pills class

BootstrapWeb DevelopmentCSS Framework

Use the card-header-pills class in Bootstrap 4 to style navigation pills in card header.

Set the navigation using the card-header-pills −

<ul class="nav nav-pills card-header-pills">

The following is the code snippet to use the car-header-pills class with the na-pills class −

<div class="card">
  <div class="card-header">
    <ul class="nav nav-pills card-header-pills">
      <li class="nav-item">
        <a class="nav-link active" href="#">Java</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">C</a>
      </li>
    </ul>
  </div>
</div>

The following is an example to implement the card-header-pills Bootstrap 4 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">
    <h2>Programming</h2>
    <div class="card">
      <div class="card-header">
        <ul class="nav nav-pills card-header-pills">
          <li class="nav-item">
            <a class="nav-link active" href="#">Java</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#">C</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#">C++</a>
          </li>
        </ul>
      </div>
      <div class="card-body">
        <h5 class="card-title">Java Installation</h5>
        <p class="card-text">Download JAVA JDK from Oracle Java website and...</p>
      </div>
    </div>
   </div>
</body>
</html>
raja
Published on 10-Jul-2018 14:08:06
Advertisements