scroll-initial-target

A property that tells the browser to automatically 'snap' to a specific element when the page first loads or when a container first appears.

It is documented as part of the CSS Scroll Snap specification. This is an experimental technology. The syntax and behavior are still subject to change.

/* Usage Example */
.important-section {
  /* Keeps this section centered in view when the container loads */
  scroll-initial-target: nearest;
}

/* Syntax */
scroll-initial-target: none;
scroll-initial-target: nearest;

/* Global values */
scroll-initial-target: inherit;
scroll-initial-target: initial;
scroll-initial-target: revert;
scroll-initial-target: revert-layer;
scroll-initial-target: unset;
Limited availability Since 2020 69% global usage

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

133+
133+
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