CSS Basics

CSS Lists

Style HTML lists with custom bullets, numbers, and layouts. Create navigation menus, content lists, and structured information displays.

How do you remove or change bullets in a CSS list?

Use list-style: none on the ul or ol to remove the bullets, and reset padding and margin to remove the indent. To change the bullets, use list-style-type (disc, square, decimal…) or style the ::marker pseudo-element.

ul.reset { list-style: none; padding: 0; margin: 0; }
ol       { list-style-type: upper-roman; }
li::marker { color: #3b82f6; font-weight: bold; }
ul.checks li::before { content: "✓ "; color: green; }

List Styling Demo

Unordered Lists

ul { list-style-type: disc; }
ul { list-style-type: circle; }
ul { list-style-type: square; }

Bullet points for items without specific order

Ordered Lists

ol { list-style-type: decimal; }
ol { list-style-type: upper-roman; }
ol { list-style-type: lower-alpha; }

Numbered or lettered lists for sequential items

Custom List Styles

li { list-style: none; }
li::before { content: '→ '; }
li { background: url('icon.png'); }

Custom markers and styling for unique list designs

Code Editor

<ul class="checks">
  <li>Write HTML</li>
  <li>Style with CSS</li>
  <li>Add JavaScript</li>
</ul>

<ol class="steps">
  <li>Plan</li>
  <li>Build</li>
  <li>Ship</li>
</ol>

<nav><ul class="menu"><li>Home</li><li>Courses</li><li>Blog</li></ul></nav>

Preview

Understanding List Styling

CSS list styling goes far beyond simple bullet points. Modern web development requires sophisticated list designs for navigation, content organization, timelines, and user interfaces. Master these techniques to create professional, accessible, and visually appealing list layouts.

Core Properties

  • list-style-type - Marker appearance
  • list-style-position - Marker positioning
  • list-style-image - Custom images
  • list-style - Shorthand property

Advanced Techniques

  • CSS Counters for complex numbering
  • Pseudo-elements for custom markers
  • Flexbox/Grid for modern layouts
  • Responsive design patterns

Built-in List Style Types

Unordered Lists (UL)

Visual Markers

  • disc - Filled circles (default)
  • circle - Hollow circles
  • square - Filled squares
  • none - No markers

Example Usage

ul {list-style-type: circle;}

Ordered Lists (OL)

Numbering Systems

  • decimal - 1, 2, 3... (default)
  • decimal-leading-zero - 01, 02, 03...
  • lower-roman - i, ii, iii...
  • upper-roman - I, II, III...
  • lower-alpha - a, b, c...
  • upper-alpha - A, B, C...
  • lower-greek - α, β, γ...

Best Practices & Accessibility

Do's

  • • Use semantic HTML (<ul>, <ol>, <dl>)
  • • Provide focus indicators for interactive lists
  • • Test with screen readers
  • • Use proper contrast ratios
  • • Consider reduced motion preferences
  • • Reset margins/padding for consistency

Don'ts

  • • Don't rely solely on color for meaning
  • • Avoid removing list semantics
  • • Don't use tables for list data
  • • Avoid excessive animations
  • • Don't ignore mobile responsiveness
  • • Avoid complex nested structures

Performance Tips

Large Lists

  • • Use virtual scrolling for 1000+ items
  • • Avoid expensive CSS properties
  • • Consider pagination or lazy loading

Animations

  • • Use transform instead of layout changes
  • • Limit to opacity and transform
  • • Respect prefers-reduced-motion

CSS Lists — step by step

1 / 4
1

list-style-type

Change list markers with list-style-type: disc, circle, square for ul, or decimal, lower-alpha, lower-roman for ol.

1 of 4
💡Use ::marker to Style List Bullets
The ::marker pseudo-element lets you change the color, size, and content of list markers directly — much cleaner than the old trick of setting list-style: none and using ::before for custom bullets.

🎯 Quick Check

Which CSS pseudo-element targets the bullet or number of a list item?

Styling Lists with CSS: summary

Key points

  • Navigation menus are usually a ul with list-style: none and display: flex.
  • ::marker supports color, font-* and content, but not layout properties.
  • In Safari, list-style: none removes the list role for screen readers; add role="list" if the list semantics matter.

Frequently asked questions

›How do I make a horizontal list?

Set display: flex; gap: 1rem; list-style: none; padding: 0; on the ul.

›How do I change the bullet color?

Use li::marker { color: red; }, or remove the bullets and add your own with li::before.