List Group with Badges as Element
You can create badges using the <span> element by styling it using different CSS properties like border-radius, padding, background-color, and color.
Example: The below code illustrates a list group with badges by styling an HTML element.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content=
"width=device-width, initial-scale=1.0">
<title>
List Group with Badges using CSS
</title>
<style>
@import url(
'https://fonts.googleapis.com/css2?family=Poppins&display=swap');
* {
margin: 0;
padding: 0;
}
body {
font-family: 'Poppins', sans-serif;
}
span {
border-radius: 50%;
padding: 5px;
background-color: rgb(121, 150, 35);
color: rgb(248, 255, 240);
}
ul>li {
padding: 15px;
list-style: none;
font-size: 20px;
border: 1px solid green;
background-color: rgb(203, 205, 190);
}
ul {
margin: 0 20px;
}
h2 {
text-align: center;
color: green;
}
</style>
</head>
<body>
<div class="box">
<div class="card-content">
<h2>
List Group with Badges
using CSS
</h2>
<ul>
<li>
DSA Questions
<span>90</span>
</li>
<li>
Mern Questions
<span>70</span>
</li>
<li>
NodeJs Questions
<span>110</span>
</li>
<li>
Mongo Db Questions
</li>
<li>
Express JS Questions
</li>
</ul>
</div>
</div>
</body>
</html>
Output:
How to Create a List Group with Badges using CSS ?
A List Group with Badges is a UI pattern that combines a list of items with additional visual indicators (badges) to convey extra information. Badges allow you to visually highlight or categorize items within a list.
This is especially beneficial when you want to draw attention to specific elements or provide additional context. We can create badges by styling simple HTML elements or by using Icons.
Table of Content
- List Group with Badges as Element
- List Group with Badges as Icons
- Badges with different Colors
- Badges with Various Shapes