Bootstrap 5 Tutorial
An unordered list with list elements is the most fundamental type of list group:
Use <li> elements with class .list-group-item and <ul> elements with class .list-group to construct a simple list group:
- First item
- Second item
- Third item
To make the current object stand out, use the .active class:
- Active item
- Second item
- Third item
Instead of using <ul> and <li>, use <div> and <a> to build a list group with linked elements. To enable a grey background color when hovering over an item, you can optionally add the .list-group-item-action class:
The disabled item’s text color is made lighter using the .disabled class. Additionally, it will eliminate the hover effect on links when used:
Apply the .list-group-flush class to eliminate some rounded corners and borders:
First item
Second item
Third item
Fourth item
- First item
- Second item
- Third item
- Fourth item
To make list elements with numbers in front of them, use the .list-group-numbered class:
- First item
- Second item
- Third item
- Fourth item
To make the list elements appear side by side rather than stacked on top of one another, add the .list-group-horizontal class to the .list-group:
- First item
- Second item
- Third item
- Fourth item
List items can be colored using contextual classes:
The coloring list items have the following classes: .list-group-item-success, list-group-item-secondary, list-group-item-info, list-group-item-warning, .list-group-item-danger, .list-group-item-primary, list-group-item-dark and list-group-item-light,:
- Success item
- Secondary item
- Info item
- Warning item
- Danger item
- Primary item
- Dark item
- Light item
To add badges inside the list group, combine utility/helper classes with .badge classes:
-
Inbox
12
-
Ads
50
-
Junk
99
CodingAsk.com is designed for learning and practice. Examples may be made simpler to aid understanding. Tutorials, references, and examples are regularly checked for mistakes, but we cannot guarantee complete accuracy. By using CodingAsk.com, you agree to our terms of use, cookie, and privacy policy.
Copyright 2010-2024 by Refsnes Data. All Rights Reserved.