property

Scroll initial target — CSS reference

Designates a descendant as the target for initial scrolling of its scroll container. It is not a command to keep scrolling back to that element after user interaction. If multiple eligible targets exist, tree order determines the first target.

Formal Syntax & Structure

css syntaxcss
scroll-initial-target: nearest;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>scroll-initial-target</title><style>body{margin:8px;font:16px/24px sans-serif}#a{height:80px;overflow:auto;width:180px}#b{height:180px}#c{height:80px;scroll-initial-target:nearest}</style><body><div id="a" tabindex="0" aria-label="Example scroller"><div id="b">Earlier</div><div id="c">Initial target</div></div></body></html>
CSS Reference