Learn how to create a List Group with Badges, using CSS.
<ul>
<li>Inbox <span class="badge">2</span></li>
<li>Other <span class="badge">5</span></li>
<li>Saved</li>
<li>Stuff</li>
<li>Old</li>
</ul>
/* Transform a basic list into a customized list group */
ul.list-group {
list-style-type: none;
padding: 0;
margin: 0;
}
ul.list-group li {
border: 1px solid #ddd;
margin-top: -1px; /* Prevent double borders */
background-color: #f6f6f6;
padding: 12px;
}
/* Style badges inside the list group */
ul.list-group .badge {
background-color: red;
color: #fff;
font-weight: bold;
border-radius: 50%;
padding: 5px 10px;
text-align: center;
margin-left: 5px;
}
Try it Yourself »
Tip: Go to our CSS List Tutorial to learn more about HTML lists and how to style them.
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!