overflow-anchor

A browser optimization that helps keep your scroll position steady when content is added to the page above where you're looking. It prevents the page from 'jumping' unexpectedly.

It is documented as part of the CSS Scroll Anchoring specification.

/* Usage Example */
.chat-window {
  /* Prevents the scroll position from jumping when new messages load */
  overflow-anchor: auto;
}

/* Syntax */
overflow-anchor: auto;
overflow-anchor: none;

/* Global values */
overflow-anchor: inherit;
overflow-anchor: initial;
overflow-anchor: revert;
overflow-anchor: revert-layer;
overflow-anchor: unset;
Limited availability Since 2020 82% global usage

This feature is not Baseline because it does not work in some of the most widely-used browsers.

56+
66+
preview+
79+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC