Web4College

CSS overflow property

src

Description

CSS overflow property represents the behavior of content when it overflows out of the box along both horizontal and vertical directions.

It is a shorthand property of overflow-x and overflow-y.

If only one value is specified, the other one is copied from the first one.

Syntax

overflow : overflow-x   overflow-y

Property values

visibleDefault

The content overflows out of the boundaries of the box and is also visibile.

It is the same as overflow: visibile visibile;

overflow: visible;
Try it

hidden

In this case, the content that overflows out of the box becomes invisible.

It is the same as overflow: hidden hidden;.

overflow: hidden;
Try it

scroll

It provides scrollbar no matter whether the content overflows or not.

It is the same as overflow: scroll scroll;.

overflow: scroll;
Try it

auto

It is same as 'scroll' but its scrollbar is visibile only when the content overflows out of the box.

Both values are 'auto' i.e. overflow: auto auto;

overflow: auto;
Try it

Applicable to

It applies to block containers, grid containers, and flex containers.