How TO - List Group
Learn how to transform a basic list into a "list group" with CSS.
List Group
- Adele
- Agnes
- Billy
- Bob
- Calvin
- Christina
- Cindy
How To Create a List Group
Step 1) Add HTML:
Example
<ul>
<li>Adele</li>
<li>Agnes</li>
<li>Billy</li>
<li>Bob</li>
<li>Calvin</li>
<li>Christina</li>
<li>Cindy</li>
</ul>
Step 2) Add CSS:
Example
ul {
list-style-type: none; /* Remove bullets */
padding:
0; /* Remove padding */
margin: 0; /* Remove margins */
}
ul li {
border: 1px solid #ddd; /* Add a thin border
to each list item */
margin-top: -1px; /* Prevent double borders */
background-color: #f6f6f6; /* Add a grey background color */
padding: 12px; /* Add some padding */
}
Try it Yourself »
Tip: Go to our CSS List Tutorial to learn more about HTML lists and how to style them.