CSS ::marker Pseudo-Element

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The ::marker pseudo-element selects the marker box of a list item — typically the bullet or number. It works on any element set to display: list-item, such as li inside ul or ol.

Only a limited set of properties applies (color, fonts, content, and a few others). For full box styling of custom bullets, many authors still use ::before with list-style: none.

Limited availability.

Not Baseline — support varies by browser and by property. color and font styles are the safest. content on ::marker is less consistent; test before relying on it.

CSS Syntax

syntax.css
::marker { /* styles */ }

Example: li::marker { color: crimson; }.

Allowable Properties

::marker is not a value list — it accepts a short allowlist of CSS properties:

Property / groupNotesTry it
colorChange bullet or number colorTry it
Font propertiesfont-size, font-family, and related font longhandsTry it
contentReplace the marker string (support varies)Try it
With list-style-typePick disc/square/decimal, then recolor the markerTry it
Ordered list markersStyle ol numbers with color and weightTry it
Not allowedNo background, border, margin, padding, or box-shadowUse ::before

How to Use ::marker

Keep a real list, then style only the marker box.

  1. Use a semantic ul or ol with li items (or another list-item).
  2. Select li::marker (or a more specific selector).
  3. Start with color and font-size for reliable styling.
  4. Add content only after you verify support — or use ::before for full control.
PieceRequired?Role
display: list-itemYesCreates the marker box (li has this by default)
::marker stylesYesColor, font, optional content
list-style-typeOptionalChooses disc, decimal, etc. before restyling
::before fallbackOptionalWhen you need padding, backgrounds, or older support

Live Preview

Change marker color and optional content. If content does not change in your browser, that property is not applied to ::marker there.

Markers update on the sample list below. Empty content keeps the browser default bullet.

List
  • First item
  • Second item
  • Third item

color: #2563eb · content: default

CSS Examples

Each snippet focuses on ::marker with a short list. Use Try It Yourself for a live editor.

Example 1 — Color and Size

Style default bullets with color and font-size.

CSS
<style>
  ul li::marker {
    color: crimson;
    font-size: 1.5em;
  }
</style>

<ul>
  <li>Peaches</li>
  <li>Apples</li>
  <li>Plums</li>
</ul>
Try It Yourself

How It Works

  1. Keep a real list. ul / li already create marker boxes.
  2. Target li::marker. Only the bullet is selected, not the text.
  3. Set color and font-size. These are the most reliable marker styles.
  4. Item text stays unchanged. The marker box is separate from the list content.

Example 2 — Custom content

Replace the default bullet string when the browser supports it.

CSS
<style>
  ul li::marker {
    color: #b91c1c;
    content: "→ ";
  }
</style>

<ul>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ul>
Try It Yourself

How It Works

  1. Set content on ::marker. The string becomes the marker text.
  2. Include a trailing space if you want a gap before the item.
  3. Color still applies to that custom marker text.
  4. If nothing changes, your browser may not support content here — fall back to ::before.

Example 3 — Ordered List Numbers

Style decimal markers on an ol without touching the item text.

CSS
<style>
  ol li::marker {
    color: #1d4ed8;
    font-weight: 700;
    font-size: 1.1em;
  }
</style>

<ol>
  <li>Plan</li>
  <li>Build</li>
  <li>Ship</li>
</ol>
Try It Yourself

How It Works

  1. Use an ordered list. Numbers come from the list marker, not from your HTML text.
  2. Style ol li::marker. Color and weight affect the numerals.
  3. Keep semantics. Screen readers still hear a real numbered list.
  4. Change type with list-style-type if you need letters or Roman numerals.

Edge Cases & Pitfalls

Most issues come from unsupported properties or hiding markers with list-style.

limited

Not Baseline

Support is uneven. Prefer color / fonts; treat content as progressive enhancement.

props

No box model on the marker

background, border, margin, and padding do not apply. Use ::before when you need a chip-like bullet.

list-style

list-style: none removes the marker

If you hide the marker, ::marker has nothing to style. That pattern is for ::before custom bullets instead.

vs before

::marker vs ::before

::marker keeps native list semantics simple. ::before is more powerful but more layout work.

Browser Support

::marker is a browser CSS pseudo-element. Node.js, Deno, and Bun do not apply it.

✓ Limited availability · Not Baseline

::marker

Modern Chromium, Firefox, and Safari support core styling (color/fonts) with varying coverage for content. Internet Explorer does not support ::marker.

85% Core styling
Google Chrome Supported
Core yes · content varies
Mozilla Firefox Supported
Strong support
Apple Safari Supported
Core yes · content limited
Microsoft Edge Supported
Core yes · content varies
Opera Supported
Core yes
Samsung Internet Supported
Core yes
Internet Explorer No
No support
::marker Limited · Varies by property

Bottom line: Safe for color and font marker tweaks. Test content; use ::before as a fallback when you need full box styling. This is not a JavaScript runtime API.

Key Takeaways

  • Role: style the list item marker box (bullet or number).
  • Allowlist: color, fonts, content, and a few text helpers — not the full box model.
  • Start simple: li::marker { color: …; font-size: …; }.
  • Limited availability: enhance markers; fall back to ::before when needed.

One line: ::marker paints the bullet or number — keep lists semantic, style lightly, and don’t expect a full box.

Frequently Asked Questions

It selects the marker box of a list item — usually the bullet or number — so you can style that marker without changing the item text.
Any element or pseudo-element with display: list-item, such as li in ul/ol lists. summary can also have a marker in some contexts.
A limited set: color, content, font properties, white-space, quotes, some counter and direction properties, plus animation and transition properties. Background, margin, and border are not supported.
::marker styles the browser list marker. ::before inserts custom content before the item text, supports more properties, and usually needs list-style: none plus layout tweaks.
No. MDN lists Limited availability — some parts (especially content) vary by browser. Prefer color and font styles for the widest support; test content carefully.
No. It is a browser CSS pseudo-element, not a Node.js feature.

Next: :not()

Learn how to exclude matches with the :not() pseudo-class.

:not() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful