Bootstrap 4 Javascript AJAX jQuery HTML PHP Example MORE

How to create List Groups in Bootstrap 4


Basic List Groups

Basic list group, use an <ul> element with class .list-group, and <li> elements with class .list-group-item:

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap 4 List Group With Badges 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/3.4.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>List Group With Badges</h2>
  <ul class="list-group">
    <li class="list-group-item">New <span class="badge">12</span></li>
    <li class="list-group-item">Deleted <span class="badge">5</span></li>
    <li class="list-group-item">Warnings <span class="badge">3</span></li>
  </ul>
</div>

</body>
</html>

Run it Yourself »

Remove Borders

.list-group-flush class to remove some borders and rounded corners:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap 4 Remove Borders 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.5.2/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>Remove Borders</h2>
</div>
  
<div class="container">
  <ul class="list-group list-group-flush">
    <li class="list-group-item">First item</li>
    <li class="list-group-item">Second item</li>
    <li class="list-group-item">Third item</li>
    <li class="list-group-item">Fourth item</li>
  </ul>
</div>

</body>
</html>
Run it Yourself »

List Group and Linked Items With Contextual Classes

The classes list-items are: .list-group-item-sucess, .list-group-item-secondary, .list-group-info, .list-group-***

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap 4 List Group and Linked Items With Contextual Classes 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.5.2/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>List Group and Linked Items With Contextual Classes</h2>
  <ul class="list-group">
    <li class="list-group-item list-group-item-success">List Group</li>
    <li class="list-group-item list-group-item-secondary">List Group</li>
    <li class="list-group-item list-group-item-info">List Group</li>
    <li class="list-group-item list-group-item-warning">List Group</li>
    <a href="#" class="list-group-item list-group-item-action list-group-item-danger">Linked Items</a>
    <a href="#" class="list-group-item list-group-item-action list-group-item-primary">Linked Items</a>
    <a href="#" class="list-group-item list-group-item-action list-group-item-dark">Linked Items</a>
    <a href="#" class="list-group-item list-group-item-action list-group-item-light">Linked Items</a>
  </ul>
</div>

</body>
</html>

Run it Yourself »

List Group With Badges

The badges will automatically be positioned on the right:

To create a badge, create a <span> element with class .badge inside the list item:

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Colored Progress Bars 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/3.4.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>Colored Progress Bars</h2>
  <div class="progress">
    <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width:40%">
      40% Complete (success)
    </div>
  </div>
  <div class="progress">
    <div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" style="width:50%">
      50% Complete (info)
    </div>
  </div>
  <div class="progress">
    <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width:60%">
      60% Complete (warning)
    </div>
  </div>
  <div class="progress">
    <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:70%">
      70% Complete (danger)
    </div>
  </div>
</div>

</body>
</html>

Run it Yourself »