Hello folks! welcome back to a new edition of our tutorial on Bootstrap. In this section of our tutorial on Bootstrap, we will discuss about Bootstrap List Group.
The purpose of list group component is to render complex and customized content in lists. To get a basic list group -
The purpose of list group component is to render complex and customized content in lists. To get a basic list group -
- Add the .list-group class to element <ul>.
- Add .list-group-item class to <li>.
Example
Following example demonstrates this -
<ul class = "list-group"> <li class = "list-group-item">Free Domain Name Registration</li> <li class = "list-group-item">Free Window Space hosting</li> <li class = "list-group-item">Number of Images</li> <li class = "list-group-item">24*7 support</li> <li class = "list-group-item">Renewal cost per year</li> </ul>
Output
When the above example is executed, it will produce the following result -
- Free Domain Name Registration
- Free Window Space hosting
- Number of Images
- 24*7 support
- Renewal cost per year
Adding Badges to List Group
We can add the badges component to any list group item and it will automatically be positioned on the right. Simply add <span class = "badge"> within the <li> element.
Example
Following example demonstrates this -
<ul class = "list-group"> <li class = "list-group-item">Free Domain Name Registration</li> <li class = "list-group-item">Free Window Space hosting</li> <li class = "list-group-item">Number of Images</li> <li class = "list-group-item"> <span class = "badge">New</span> 24*7 support </li> <li class = "list-group-item">Renewal cost per year</li> <li class = "list-group-item"> <span class = "badge">New</span> Disocunt Offer </li> </ul>
Output
When the above example is executed, it will produce the following result -
- Free Domain Name Registration
- Free Window Space hosting
- Number of Images
- New24*7 support
- Renewal cost per year
- NewDisocunt Offer
READ: Bootstrap | Object
Linking List Group Items
By making use of the anchor tags instead of list items, we can link the list groups. In this case, we need to use <div> instead of using <ul> element.
Example
Following example demonstrates this -
<a href = "#" class = "list-group-item active"> Free Domain Name Registration </a> <a href = "#" class = "list-group-item">24*7 support</a> <a href = "#" class = "list-group-item">Free Window Space hosting</a> <a href = "#" class = "list-group-item">Number of Images</a> <a href = "#" class = "list-group-item">Renewal cost per year</a>
Output
When the above example is executed, it will produce the following result -
Free Domain Name Registration24*7 supportFree Window Space hostingNumber of ImagesRenewal cost per year
Adding Custom Content to List Group
We can add any HTML content to the above linked list groups.
Example
Following example demonstrates this -
<div class = "list-group"> <a href = "#" class = "list-group-item active"> <h4 class = "list-group-item-heading"> Starter Website Package </h4> </a> <a href = "#" class = "list-group-item"> <h4 class = "list-group-item-heading"> Free Domain Name Registration </h4> <p class = "list-group-item-text"> You will get a free domain registration with website pages. </p> </a> <a href = "#" class = "list-group-item"> <h4 class = "list-group-item-heading"> 24*7 support </h4> <p class = "list-group-item-text"> We provide 24*7 support. </p> </a> </div> <div class = "list-group"> <a href = "#" class = "list-group-item active"> <h4 class = "list-group-item-heading"> Business Website Package </h4> </a> <a href = "#" class="list-group-item"> <h4 class = "list-group-item-heading"> Free Domain Name Registration </h4> <p class = "list-group-item-text"> You will get a free domain registration with website pages. </p> </a> <a href = "#" class = "list-group-item"> <h4 class = "list-group-item-heading">24*7 support</h4> <p class = "list-group-item-text">We provide 24*7 support.</p> </a> </div>
Output
When the above example is executed, it will produce the following result -
Alright guys! This is where we are going to be rounding up for this tutorial. In our next tutorial guide, we are going to be studying about the Bootstrap Panels.
Feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.
Feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.