Thanks to visit codestin.com
Credit goes to www.cssportal.com

CSS Portal

::marker CSS Pseudo Element

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The ::marker pseudo-element in CSS is used to style the marker box of list items, which is the bullet or number displayed by lists created with the li element inside ordered (ol) or unordered (ul) lists. Unlike traditional list styling techniques that manipulate the entire li element, ::marker specifically targets only the marker portion, giving developers finer control over appearance, including color, font, and content.

The ::marker pseudo-element supports a subset of CSS properties, primarily those related to text. Commonly used properties include color, font-size, font-family, font-style, and content. This makes it particularly useful for customizing bullet points or numbering styles without affecting the rest of the list item's content.

A practical example of ::marker usage is customizing bullets in an unordered list:

<ul>
  <li>Apples</li>
  <li>Oranges</li>
  <li>Bananas</li>
</ul>
li::marker {
  color: darkorange;
  font-size: 1.2em;
  content: "→ ";
}

In this example, the default bullet is replaced with a right arrow and styled with a different color and size. Notably, ::marker cannot contain block-level elements, and properties like background-color or margin generally do not apply, as it only affects the inline marker box.

Additionally, ::marker works seamlessly with list counters in ordered lists, allowing customization of numeric markers. For example:

ol li::marker {
  font-weight: bold;
  color: teal;
  content: counter(list-item) ". ";
}

Here, each numbered list item’s marker is bold and colored teal, demonstrating how ::marker interacts with CSS counters and preserves semantic list structure while providing stylistic flexibility.

Syntax

::marker {
  /* ... */
}

Example

<ul class="custom-list">
<li>First item in the list</li>
<li>Second item with more text</li>
<li>Third item to show the style</li>
</ul>

<ol class="custom-numbers">
<li>Step one</li>
<li>Step two</li>
<li>Step three</li>
</ol>
/* Styling bullets in the unordered list */
.custom-list li::marker {
color: #ff5733;
font-size: 1.5rem;
content: "✦ "; /* Replaces the default dot with a star */
}

/* Styling numbers in the ordered list */
.custom-numbers li::marker {
color: #2e86de;
font-weight: bold;
font-family: 'Courier New', Courier, monospace;
}

/* General styling for layout */
li {
padding-left: 10px;
margin-bottom: 8px;
}

Browser Support

The following information will show you the current browser support for the CSS ::marker pseudo element. Hover over a browser icon to see the version that first introduced support for this CSS psuedo element.

This psuedo element is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 31st December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!