overflow-y

Controls what happens to content that is taller than its container. This is the most common way to add a vertical scrollbar to a box.

It is documented as part of the CSS Overflow specification.

/* Usage Example */
.code-snippet {
  max-height: 400px;
  /* Adds a vertical scrollbar if the code is long */
  overflow-y: auto;
}

/* Syntax */
overflow-y: visible;
overflow-y: hidden;
overflow-y: clip;
overflow-y: scroll;
overflow-y: auto;

/* Global values */
overflow-y: inherit;
overflow-y: initial;
overflow-y: revert;
overflow-y: revert-layer;
overflow-y: unset;
Widely available Since 2020 96% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2020.

1+
3.5+
3+
12+
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