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.

.code-snippet {
  max-height: 400px;
  /* Adds a vertical scrollbar if the code is long */
  overflow-y: auto;
}
Initial value
visible
Inherited
No
Applies to
blockContainersFlexContainersGridContainers
Animation type
discrete

Values

visiblehiddenclipscrollauto
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.

Safe to use without fallbacks.

1+
3.5+
3+
12+
ESC