pseudo-class

:target current — CSS reference

Matches the current scroll marker selected by the browser for its group. This state is determined by scroll targeting rather than a hash URL alone. Highlight current position with more than color in a real interface.

Formal Syntax & Structure

css syntaxcss
::scroll-marker:target-current { color: red; }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>:target-current</title><style>body{margin:8px;font:16px/20px sans-serif;color:black;background:white}#s{width:200px;height:100px;display:flex;overflow:auto;scroll-snap-type:x mandatory;scroll-marker-group:after}#s>div{flex:0 0 200px;scroll-snap-align:start;background:#e2e8f0}#s::scroll-marker-group{display:flex;gap:10px}#s>div::scroll-marker{content:"●";color:blue}#s>div::scroll-marker:target-current{color:red}#s::scroll-button(inline-end){content:"Next";display:block;width:80px;height:32px}</style><body><div id="s"><div id="a">First</div><div id="b">Second</div><div id="c">Third</div></div></body></html>
CSS Reference