CSS ::marker Selector

Beginner
⏱️ 6 min read
📚 Updated: Jul 2026
🎯 4 Examples
List Styling

What You’ll Learn

The ::marker pseudo-element targets list bullets and numbers. Style markers without touching the list item text or adding extra HTML.

01

Bullets

ul markers.

02

Numbers

ol markers.

03

content

Custom glyph.

04

color

Tint markers.

05

Limited

Few properties.

06

vs ::before

Know when.

Introduction

The ::marker pseudo-element in CSS is used to target and style the marker of list items. This includes bullets in unordered lists (<ul>) and numbers or letters in ordered lists (<ol>).

By using ::marker, you can customize list markers beyond their default styling, giving you more control over list design on your web pages.

Definition and Usage

Write li::marker or ul li::marker to style the automatically generated bullet or number. The marker is separate from the list item’s text content.

💡
Beginner Tip

::marker only supports a small set of CSS properties. If you need backgrounds, borders, or complex layouts on bullets, use ::before with list-style: none instead.

📝 Syntax

The syntax for the ::marker pseudo-element is:

syntax.css
::marker {
  /* CSS properties */
}

The ::marker pseudo-element applies to <li> elements inside <ul> and <ol> lists, as well as <summary> elements.

Basic Example

marker-basic.css
ul li::marker {
  color: #b91c1c;
  font-size: 1.15em;
  content: "→ ";
}
li::marker ul li::marker ol li::marker

Allowed Properties

PropertySupported on ::marker
colorYes
font-size, font-familyYes
contentYes (replaces default bullet/number)
background, borderNo
box-shadow, paddingNo

Syntax Rules

  • Use double colon ::marker for pseudo-elements (modern syntax).
  • Only a limited set of properties applies to markers.
  • content replaces the default bullet or number glyph.
  • Works on li in both ul and ol lists.
  • For heavy customization, fall back to ::before on li.

Related Selectors

  • ::before — alternative for fully custom list bullets
  • list-style-type property — changes bullet shape without ::marker
  • :first-child / :last-child — style list items by position
  • counter() in content — custom numbered markers on ordered lists

⚡ Quick Reference

QuestionAnswer
Selector typePseudo-element
Syntaxli::marker
TargetsList bullets and numbers
Key propertiescolor, font-size, content
Common useColored arrows, custom bullets, styled numbers
Browser supportAll modern browsers (not IE)

When to Use ::marker

::marker is ideal for list presentation tweaks:

  • Brand-colored bullets — Match list markers to your site palette.
  • Arrow or icon bullets — Replace discs with content: "→ ".
  • Styled numbers — Bold or colorize ordered list counters.
  • Readable docs — Increase marker size without enlarging list text.
  • Quick wins — Simpler than rebuilding lists with ::before.

👀 Live Preview

Red arrow markers styled with ul li::marker:

  • First item
  • Second item
  • Third item

Examples Gallery

Practice ::marker with unordered lists, ordered lists, color sizing, and comparison with ::before.

📜 Core Patterns

Customize bullets and numbers on list items.

Example 1 — Arrow bullets on unordered list

Replace default discs with red arrows using content on ::marker.

marker-ul.html
<style>
  ul li::marker {
    color: #b91c1c;
    font-size: 1.15em;
    content: "→ ";
  }
</style>

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

How It Works

The content property replaces the default bullet. color and font-size style the arrow glyph independently from the list text.

Example 2 — Styled numbers on ordered list

Make ordered list numbers bold and blue with bracket formatting.

marker-ol.css
ol li::marker {
  font-weight: 700;
  color: #2563eb;
  content: "[" counter(list-item) "] ";
}
Try It Yourself

How It Works

counter(list-item) inserts the list item’s number. Wrapping it in brackets creates a custom numbered format without changing the HTML.

📄 Sizing & Alternatives

Tune marker appearance and know when to use ::before instead.

Example 3 — Color and font-size only

Keep default bullets but make them larger and green — no content override needed.

marker-color.css
li::marker {
  color: #16a34a;
  font-size: 1.25em;
}
Try It Yourself

How It Works

Without changing content, the browser keeps the default disc shape. Only the marker’s color and size change.

Example 4 — When ::before is the better choice

For background circles or complex bullets, use ::before with list-style: none.

marker-vs-before.css
/* ::marker — limited to text properties */
li::marker {
  color: #2563eb;
}

/* ::before — full styling when marker is not enough */
ul.custom li {
  list-style: none;
  position: relative;
  padding-left: 1.5rem;
}

ul.custom li::before {
  content: "";
  position: absolute;
  left: 0;
  width: 0.5rem;
  height: 0.5rem;
  background: #2563eb;
  border-radius: 50%;
  top: 0.55em;
}
Try It Yourself

How It Works

::marker cannot set background or border-radius. For filled circle bullets, hide the default marker and build one with ::before.

💬 Usage Tips

  • Limited properties — Stick to color, font-size, font-family, and content on ::marker.
  • content replacement — Use content to swap bullets for arrows, emojis, or symbols.
  • Ordered lists — Combine counter(list-item) with custom brackets or prefixes.
  • Readability — Increase font-size on markers to make lists easier to scan.
  • Heavy customization — Reach for ::before when you need backgrounds or shapes.

⚠️ Common Pitfalls

  • Unsupported properties — Background, border, padding, and box-shadow do not work on ::marker.
  • Internet Explorer — IE does not support ::marker; provide a ::before fallback.
  • list-style: none — Removing list markers disables ::marker; the pseudo-element has nothing to style.
  • Overriding content carelessly — Changing content on ol may break expected numbering unless you use counters.
  • Accessibility — Keep semantic <ul>/<ol>; decorative markers should not replace list structure.

♿ Accessibility

  • Preserve list semantics — Use real <ul> and <ol> elements; screen readers rely on them.
  • Do not remove markers silently — If you hide bullets with list-style: none, ensure content is still navigable.
  • Color contrast — Marker colors should be distinguishable from the background.
  • Meaningful order — On ordered lists, keep logical sequence when customizing numbers.

🧠 How ::marker Works

1

Browser creates marker

For each <li>, the browser generates a bullet or number marker box.

Generate
2

::marker targets it

CSS rules on li::marker apply only to that marker box, not the text.

Target
3

Limited styles apply

Only permitted properties like color, font-size, and content affect the marker.

Style
=

Styled lists

Bullets and numbers match your design without extra HTML.

🖥 Browser Compatibility

::marker is supported in all modern browsers. Internet Explorer does not support it.

Baseline · Modern browsers

List marker styling today

::marker works in Chrome, Firefox, Safari, and Edge. Use ::before for IE fallbacks.

96% Modern support
Google Chrome 86+ · Desktop & Mobile
Full support
Mozilla Firefox 68+ · Desktop & Mobile
Full support
Apple Safari 11.1+ · macOS & iOS
Full support
Microsoft Edge 86+ (Chromium)
Full support
Internet Explorer Not supported
Use ::before fallback
::marker pseudo-element 96% supported

Bottom line: ::marker is safe for modern projects; use ::before bullets only when IE support is required.

🎉 Conclusion

The ::marker selector gives you control over list bullets and numbers, helping align list styles with your overall page design.

While limited in which properties it accepts, it provides a simple way to customize lists without affecting content. For advanced bullet shapes, combine with ::before when needed.

💡 Best Practices

✅ Do

  • Use ::marker for color and content tweaks on lists
  • Keep semantic ul/ol markup
  • Use counter(list-item) for custom ol formats
  • Fall back to ::before for complex bullets
  • Test ordered list numbering after content changes

❌ Don’t

  • Apply background or border to ::marker
  • Set list-style: none and expect ::marker to work
  • Replace lists with divs just for styling
  • Assume IE supports ::marker
  • Override ol content without a counter plan

Key Takeaways

Knowledge Unlocked

Five things to remember about ::marker

Use these points when styling list markers.

5
Core concepts
:: 02

li::marker

Syntax.

Pattern
3 03

content

Custom glyph.

Property
! 04

Limited

Few props.

Rule
🌐 05

96% support

Not IE.

Compat

❓ Frequently Asked Questions

The ::marker pseudo-element targets the bullet or number displayed before a list item in ul and ol lists. It lets you style markers without changing the list item text.
::marker applies to li elements inside ul or ol lists, and also summary elements. The list item must have a visible marker generated by the browser.
Only a limited set: mainly color, font-size, font-family, content, white-space, and a few font-related properties. Background, border, and box-shadow are not supported on ::marker.
::marker styles the browser-generated list bullet or number. ::before inserts custom content before the li text and supports more properties, but requires list-style: none and manual layout.
All modern browsers support ::marker. Internet Explorer does not. For legacy support, use ::before on li elements as a fallback.

Practice in the Live Editor

Open the HTML editor and experiment with ::marker, custom bullets, and list styling.

HTML Editor →

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