::scroll-marker CSS Pseudo Element
Description
The ::scroll-marker pseudo-element is a specialized CSS feature that allows developers to style markers within scrollable containers, particularly when using the CSS Scroll-Linked Animations specification. It is primarily used in conjunction with elements that are scrollable, such as those with the CSS overflow properties, to visually indicate the position or presence of certain points along the scrollable content. This pseudo-element is often seen in contexts like scroll-snapping, custom scrollbars, or any situation where precise control over the visual markers within a scrollable area is required.
The ::scroll-marker pseudo-element can be attached to elements with a scrolling context, including block containers or elements with a overflow set to auto or scroll. When used, it allows styling of these scroll indicators in ways similar to other pseudo-elements like ::before and ::after, providing options for visual customization such as color, size, and shapes without altering the underlying document structure.
One practical application of ::scroll-marker is in enhancing the user experience for scrollable lists, tables, or code blocks. For instance, when a developer wants to highlight certain positions in a long list, ::scroll-marker can be styled to create dots, bars, or other visual cues along the scrollbar track. This can also complement the behavior of scrollbar-track styling.
Here is an example demonstrating its basic usage:
.scrollable-container::scroll-marker {
background-color: #ff6600;
height: 8px;
width: 8px;
border-radius: 50%;
}
<div class="scrollable-container">
<p>Item 1</p>
<p>Item 2</p>
<p>Item 3</p>
<!-- more items -->
</div>
In this example, each scroll marker inside the .scrollable-container will be rendered as a small, orange circular indicator, providing a visual cue for scrollable positions.
Styling of ::scroll-marker supports various CSS properties, including background-color, height, width, and border-radius. However, it is important to note that support for this pseudo-element is limited and may vary across browsers, as it is considered part of experimental scroll-linked features.
Because it is a visual enhancement pseudo-element, ::scroll-marker does not affect the layout of the document itself, similar to other pseudo-elements like ::before. It serves purely decorative and informational purposes for the scrollable container.
Syntax
::scroll-marker {
/* ... */
}
Example
Browser Support
The following information will show you the current browser support for the CSS ::scroll-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 in some modern browsers, but not all.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
