Styling Lists: list-style, Marker Position and ::marker
Styling list markers: list-style-type keywords and strings, image markers, inside and outside positions, the list-style shorthand, how browsers indent lists, ::marker, removing bullets without losing semantics, and HTML numbering attributes.
kvi5hnuCode Sprout team member8 min readOn this page
Lists are everywhere in interfaces: navigation, steps, feature lists, comment threads, menus. HTML provides <ul>, <ol> and <li>. CSS controls the marker, the bullet or number in front of each item, and how the list is indented.
list-style-type
list-style-type chooses the marker. It applies to any element with display: list-item, which is the default for <li>, and it's inherited, so it's usually set on the list:
ul.features { list-style-type: square; }
ol.steps { list-style-type: lower-roman; }
ol.legal { list-style-type: upper-alpha; }
.checklist { list-style-type: "✓ "; } /* any string */
| Kind | Examples |
|---|---|
| Symbols | disc (default), circle, square, disclosure-open, disclosure-closed |
| Numbers | decimal, decimal-leading-zero (01, 02…), lower-roman, upper-roman |
| Letters | lower-alpha or lower-latin, upper-alpha, lower-greek |
| Other scripts | arabic-indic, armenian, devanagari, georgian, hebrew, hiragana, katakana, thai, cjk-decimal, japanese-formal, korean-hangul-formal, simp-chinese-informal and many more |
| A string | "→ ", "★ ": the same string for every item |
| A counter style | a name from @counter-style (article 97), or symbols() |
none | no marker |
A few details, tested in Chrome:
nonehides the marker but doesn't stop counting: in an<ol>where the second item hadlist-style-type: none, the third item was still numbered 3.- An unknown name, like
lower-hexadecimal(which only Safari supports), is treated as an undefined counter style and falls back todecimal. - The browser's own styles give nested lists different bullets. Nested
<ul>items computed todisc, thencircle, thensquare. Inheritance won't override that: set nested lists explicitly, for exampleul ul { list-style-type: disc; }.
list-style-type doesn't care whether the list is <ul> or <ol>: an ordered list can use bullets, and an unordered one numbers. But choose the HTML element by meaning, ordered when the order matters, and style it afterwards.

The string value is used as is, so include the trailing space; with none, the items keep their indent because the padding belongs to the list, not the marker.
Image markers: list-style-image
ul.brand { list-style-image: url(leaf.svg); list-style-type: square; } /* square if the image fails */
Images are drawn at their natural size, so use small images, ideally SVGs sized for the text. Any <image> works, including gradients, which are sized to about 1em. Keep a list-style-type as a fallback, and since list-style-image is inherited too, reset it in nested lists with list-style-image: none.
For full control over a marker's size and position, images are limiting. A ::before pseudo-element, described below, is more flexible.
list-style-position

outside(default): the marker hangs outside the item's box, in the list's padding. Wrapped lines line up with the first line's text.inside: the marker is placed like an inline box at the start of the content. Wrapped lines start under the marker.
inside is useful when items have a background or border that should include the marker, or when the list has no padding.
The list-style shorthand
list-style sets the type, image and position, in any order:
li { list-style: square inside; }
ul { list-style: none; }
Omitted values reset to their initials. Tested in Chrome: list-style: url(x.png) also set the type to disc and the position to outside. And list-style: none set both the type and the image to none.
How lists are indented
The indentation of a list comes from the browser's styles, not from the list items. Tested in Chrome: a <ul> has padding-inline-start: 40px and no inline margin, only 1em block margins above and below (nested lists get none). The markers sit in that padding. So:
.plain-list { list-style: none; padding-inline-start: 0; } /* no markers, no indent */
.tight-list { padding-inline-start: 1.25em; } /* smaller indent; markers still fit */
If you remove the padding and keep outside markers, the markers hang outside the list, possibly beyond the edge of its container. Using em for the indent keeps it in proportion to the text. Some older browsers indented with margin instead, so resetting both margin and padding is a safe habit in reset stylesheets.
The gap between the marker and the text isn't directly controllable. Use a string marker with trailing spaces, or ::marker { content: ... }, to change it.

The tints show where each part lives: an outside marker is never inside the item's box, which is why removing the list's padding pushes it out of the list entirely.
::marker
::marker (article 13) styles the marker box itself:
li::marker { color: #8a3b12; font-weight: 700; }
ol.steps li::marker { content: counter(list-item) ") "; font-variant-numeric: tabular-nums; }
li.done::marker { content: "✓ "; }
Only a few properties apply:
contentcolor- the
font-*properties white-spacedirection,unicode-bidiandtext-combine-upright- animations and transitions
Box properties don't apply. Tested in Chrome: margin, padding and background on ::marker were ignored and computed to their initial values, while color, font-size: 30px and content: "→ " worked.
counter(list-item) is the built-in counter that numbers list items (article 96). ::marker works in all browsers: Safari supported only color and font-size until 27.3.
Custom markers with ::before
When you need a marker with a background, a size, or a precise position, turn the native marker off and build your own:
.steps { list-style: none; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2rem 1fr; gap: 0.6rem; }
.steps li::before {
content: counter(step);
inline-size: 2rem; block-size: 2rem; display: grid; place-items: center;
border-radius: 50%; background: #8a3b12; color: white; font-weight: 700;
}
Removing bullets without losing semantics
list-style: none is common for navigation and card grids. Safari's VoiceOver deliberately stops announcing a list as a list when its markers are removed, on the grounds that it no longer looks like one, except inside <nav>. If the list structure matters to users, for example a list of search results where "list, 12 items" is useful, add role="list":
<ul role="list" class="plain-list">
HTML controls for numbering
Numbering belongs partly in HTML, because it's content:
| HTML | Effect | Tested in Chrome |
|---|---|---|
<ol start="11"> | start counting at 11 | first item numbered 11 |
<ol reversed> | count down | three items numbered 3, 2, 1 |
<li value="10"> | this item is 10; later items continue from it | 1, 10, 11 |
<ol type="a"> | letters, Roman numerals and so on | same as list-style-type, but the type means something, like in legal documents |
Any element with display: list-item gets a marker and takes part in the list-item counter. Tested in Chrome: a <div> with display: list-item showed a bullet.
body { font: 0.85rem/1.45 system-ui, sans-serif; margin: 1rem; }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 0.8rem; }
ol, ul { margin: 0 0 0.6rem; }
.steps { list-style: none; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 1.6rem 1fr; gap: 0.5rem; margin-bottom: 0.5rem; }
.steps li::before {
content: counter(step);
inline-size: 1.6rem; block-size: 1.6rem; display: grid; place-items: center;
border-radius: 50%; background: #8a3b12; color: white; font-weight: 700;
}
.features { padding-inline-start: 1.3em; }
.features li::marker { content: "○ "; color: #999; }
.features li.done::marker { content: "✓ "; color: #2f7d32; font-weight: 700; }
.inside, .outside { background: #f4efe6; padding-block: 0.3rem; }
.inside { list-style-position: inside; padding-inline: 0.4rem; }
.outside { padding-inline-start: 1.6rem; }
.inside li::marker, .outside li::marker { color: #8a3b12; }
The numbered steps use ::before for full control; the feature list uses ::marker with content; and the last two lists compare inside and outside positions.
What's current
- String values for
list-style-type: all browsers. ::markerwithcontentand all allowed properties: all browsers since Safari 27.3.symbols()as alist-style-type: Firefox, and Chrome since 155.
Common questions
How do I change the bullet color?
li::marker { color: ... }.
How do I remove bullets and indentation?
list-style: none; padding-inline-start: 0; on the list. Add role="list" if the list semantics should still be announced.
Why can't I add a margin to ::marker?
Only a few properties apply to it, and box properties aren't among them. Use spaces in its content, or a ::before marker.
Why don't my nested lists inherit square?
The browser's styles set nested ul markers to circle and square directly, which beats inheritance. Style nested lists explicitly.
Summary
list-style-typetakes keywords for many scripts, strings, counter styles, ornone, which still counts.list-style-imagedraws images at natural size; keep a type as fallback.outsidemarkers hang in the list's padding (40px by default);insideputs them in the first line.list-stylesets type, image and position, resetting what's omitted.::markerstyles color, font and content; use::beforefor markers that need box properties.list-style: nonecan remove list semantics in Safari: addrole="list"when it matters.- Use
start,reversedandvaluein HTML for meaningful numbering.
Practice questions
Write CSS for a list that uses "→" as its marker, in a red color, without changing the item text color.
Answer
li::marker { content: "→ "; color: red; }
Or list-style-type: "→ " on the list, with li::marker { color: red; }.
An <ol>'s second item has list-style-type: none. What number does the third item show?
Answer
nonehides the marker but the item is still counted.
A designer wants list items with a full-width background, with the bullets inside the colored area. Which property helps?
Answer
list-style-position: inside puts the marker inside the item's box, so the background covers it. Alternatively, keep outside and add padding to the <li> instead of the list.
Why might this not work as expected?
li::marker { content: "•"; padding-inline-end: 1rem; }
Answer
padding doesn't apply to ::marker, so it's ignored. Add the space in the content instead, content: "• ", or build the marker with ::before.
Previous: Readable Typography: Measure, Line Height, Vertical Rhythm and Spacing
Next: Generated Content: the content Property, Quotes and attr()

More in CSS Course
Quiz: CSS Delicate Details
Twenty-five questions on the edge cases that surprise experienced developers: invalid custom properties, shorthands that reset values, layer order with !important, containing blocks, margin collapsing, specificity of :is() and :where(), intrinsic minimum sizes, and more, each checked in Chrome.
Quiz: CSS Interview Questions
Thirty front-end interview questions: cascade, specificity and layers, box model and margin collapsing, stacking contexts, positioning, flexbox and grid, responsive design, custom properties, performance, accessibility, modern selectors and architecture.
Quiz: CSS Course Final Exam
Thirty questions across the whole CSS course: syntax and error handling, selectors, the cascade and layers, values and units, color, the box model, backgrounds, positioning, flexbox, grid, responsive design, typography, generated content, effects, transforms, motion and architecture.
Quiz: CSS Architecture, Tooling and Debugging (CSS Part 17)
Twenty questions on modular CSS and BEM, layering a stylesheet, design tokens and theming, pattern libraries and safe refactoring, preprocessors and build tools, the at-rules reference, and debugging common CSS problems.
Discussion
Sign in to ask a question or share what you learned.