CSS List Styles
Master CSS list styling to customize bullets, numbers, markers, and create beautiful ordered and unordered lists.
CSS provides extensive control over list styling, allowing you to customize markers, positions, and create custom list designs.
List Style Type
Unordered Lists
ul {
list-style-type: disc; /* Default */
}
.circle-list {
list-style-type: circle;
}
.square-list {
list-style-type: square;
}
.none-list {
list-style-type: none;
}Ordered Lists
ol {
list-style-type: decimal; /* Default: 1, 2, 3 */
}
.lower-alpha {
list-style-type: lower-alpha; /* a, b, c */
}
.upper-alpha {
list-style-type: upper-alpha; /* A, B, C */
}
.lower-roman {
list-style-type: lower-roman; /* i, ii, iii */
}
.upper-roman {
list-style-type: upper-roman; /* I, II, III */
}
.decimal-leading-zero {
list-style-type: decimal-leading-zero; /* 01, 02, 03 */
}List Style Position
.outside {
list-style-position: outside; /* Default - marker outside content */
}
.inside {
list-style-position: inside; /* Marker inside content */
}List Style Image
.custom-marker {
list-style-image: url('marker.png');
}
.icon-list {
list-style-image: url('data:image/svg+xml,...');
}List Style Shorthand
ul {
list-style: square inside url('marker.png');
/* type position image */
}
ol {
list-style: upper-roman outside;
}Custom Markers with ::marker
li::marker {
color: #007bff;
font-weight: bold;
font-size: 1.2em;
}
.custom-marker li::marker {
content: '✓ ';
color: #28a745;
}Removing Default Styling
ul, ol {
list-style: none;
margin: 0;
padding: 0;
}Custom List Styles
Check Mark List
.check-list {
list-style: none;
padding-left: 0;
}
.check-list li {
padding-left: 30px;
position: relative;
}
.check-list li::before {
content: '✓';
position: absolute;
left: 0;
color: #28a745;
font-weight: bold;
}Numbered Circles
.numbered-circles {
list-style: none;
counter-reset: item;
padding-left: 0;
}
.numbered-circles li {
counter-increment: item;
padding-left: 50px;
position: relative;
margin-bottom: 20px;
}
.numbered-circles li::before {
content: counter(item);
position: absolute;
left: 0;
width: 30px;
height: 30px;
border-radius: 50%;
background-color: #007bff;
color: white;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
}Icon List
.icon-list {
list-style: none;
padding-left: 0;
}
.icon-list li {
padding-left: 35px;
position: relative;
margin-bottom: 10px;
}
.icon-list li::before {
content: '→';
position: absolute;
left: 0;
color: #007bff;
font-size: 1.5em;
}Nested Lists
ul ul {
list-style-type: circle;
margin-left: 20px;
}
ul ul ul {
list-style-type: square;
}Styled Lists
Bordered List
.bordered-list {
list-style: none;
padding: 0;
}
.bordered-list li {
padding: 15px;
border-bottom: 1px solid #ddd;
}
.bordered-list li:last-child {
border-bottom: none;
}Card List
.card-list {
list-style: none;
padding: 0;
}
.card-list li {
padding: 20px;
margin-bottom: 15px;
background: white;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}Striped List
.striped-list {
list-style: none;
padding: 0;
}
.striped-list li {
padding: 10px;
}
.striped-list li:nth-child(even) {
background-color: #f8f9fa;
}Horizontal Lists
.horizontal-list {
list-style: none;
padding: 0;
display: flex;
gap: 20px;
}
.horizontal-list li {
display: inline-block;
}Definition Lists
dl {
display: grid;
grid-template-columns: auto 1fr;
gap: 10px 20px;
}
dt {
font-weight: bold;
color: #333;
}
dd {
margin: 0;
color: #666;
}Counter Styling
.custom-counter {
list-style: none;
counter-reset: section;
}
.custom-counter li {
counter-increment: section;
}
.custom-counter li::before {
content: counter(section) ". ";
font-weight: bold;
color: #007bff;
}Nested Counters
ol {
counter-reset: item;
list-style: none;
}
ol li {
counter-increment: item;
}
ol li::before {
content: counters(item, ".") " ";
font-weight: bold;
}Feature List
.feature-list {
list-style: none;
padding: 0;
}
.feature-list li {
padding: 15px 15px 15px 50px;
position: relative;
margin-bottom: 15px;
background-color: #f8f9fa;
border-left: 4px solid #007bff;
}
.feature-list li::before {
content: '★';
position: absolute;
left: 15px;
color: #ffc107;
font-size: 1.5em;
}Timeline List
.timeline {
list-style: none;
padding: 0;
position: relative;
}
.timeline::before {
content: '';
position: absolute;
left: 20px;
top: 0;
bottom: 0;
width: 2px;
background-color: #007bff;
}
.timeline li {
padding-left: 50px;
position: relative;
margin-bottom: 30px;
}
.timeline li::before {
content: '';
position: absolute;
left: 14px;
top: 0;
width: 14px;
height: 14px;
border-radius: 50%;
background-color: #007bff;
border: 3px solid white;
box-shadow: 0 0 0 2px #007bff;
}Best Practices
List Best Practices
- Use semantic HTML (ul, ol, li)
- Remove default styling before customizing
- Ensure custom markers are accessible
- Maintain adequate spacing between items
- Use consistent styling across similar lists
- Consider responsive design for horizontal lists
- Test with screen readers
- Provide sufficient contrast for markers
- Use counters for complex numbering
- Keep nested lists readable
Accessibility
- Use proper semantic markup
- Ensure markers are visible
- Maintain good contrast
- Don't rely on color alone
- Test with keyboard navigation
- Consider screen reader announcements
Master list styling to create organized, visually appealing content!
How is this guide?
Sign in to share your feedback
Help us improve by sharing your thoughts on this guide.
Last updated on
CSS Hover Effects
Master CSS hover effects to create interactive, engaging user experiences with transitions, transforms, and creative animations.
CSS Images
Learn CSS image styling techniques including sizing, positioning, filters, effects, and responsive images for modern web design.
© 2026CoderrShyamAll Rights Reserved.