CSS overflow Property

Definition and Usage

The overflow property specifies what should happen if content overflows an element’s box.

This property specifies whether to clip content or to add scrollbars when an element’s content is too big to fit in a specified area.

Example

Result

Property Values

Value Description Demo
visible The overflow is not clipped. It renders outside the element’s box. This is default
hidden The overflow is clipped, and the rest of the content will be invisible. Content can be scrolled programmatically (e.g. by setting scrollLeft or scrollTo())
clip The overflow is clipped, and the rest of the content will be invisible. Forbids scrolling, including programmatic scrolling.
scroll The overflow is clipped, but a scroll-bar is added to see the rest of the content
auto If overflow is clipped, a scroll-bar should be added to see the rest of the content
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

CSS overflow-anchor Property

 

Definition and Usage

The overflow-anchor property makes it possible to turn off scroll anchoring.

Scroll anchoring is a feature in the browser that prevents a viewable area that is scrolled into focus to move when new content is loaded above. This is typically a problem on a slow connection if the user scrolls down and starts reading before the page is fully loaded.

Example

Result

Property Values

Value Description
auto Default value. Scroll anchoring is enabled
none Scroll anchoring is disabled
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

CSS overflow-wrap Property

Definition and Usage

The overflow-wrap property specifies whether or not the browser can break lines with long words, if they overflow the container.

Example

Result

Property Values

Value Description Demo
normal Long words will not break, even if they overflow the container. This is default
anywhere Long words will break if they overflow the container
break-word Long words will break if they overflow the container
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

CSS overflow-x Property

Definition and Usage

The overflow-x property specifies whether to clip the content, add a scroll bar, or display overflow content of a block-level element, when it overflows at the left and right edges.

Example

Result

Property Values

Value Description Demo
visible The content is not clipped, and it may be rendered outside the left and right edges. This is default
hidden The content is clipped – and no scrolling mechanism is provided
scroll The content is clipped and a scrolling mechanism is provided
auto Should cause a scrolling mechanism to be provided for overflowing boxes
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

CSS overflow-y Property

Definition and Usage

The overflow-y property specifies whether to clip the content, add a scroll bar, or display overflow content of a block-level element, when it overflows at the top and bottom edges.

Example

Result

CSS overscroll-behavior Property

Definition and Usage

The overscroll-behavior property is used to turn off scroll chaining or overscroll affordance on an element when you try to scroll past the scroll boundary.

The overscroll-behavior property is a shorthand for the following properties:

Values for the overscroll-behavior property can be set in different ways:

Example

Result

Property Values

Value Description
auto Allows scroll chaining and overscroll affordance behavior. This is default
contain Allows overscroll affordance behavior, but not scroll chaining.
none Does not allow overscroll affordance or scroll chaining behavior.
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

CSS overscroll-behavior-x Property

Definition and Usage

The overscroll-behavior-x property is used to turn off scroll chaining or overscroll affordance on an element when you try to scroll past the scroll boundary in the x-direction.

Example

Result

Property Values

Value Description
auto Allows scroll chaining and overscroll affordance behavior. This is default
contain Allows overscroll affordance behavior, but not scroll chaining.
none Does not allow overscroll affordance or scroll chaining behavior.
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

CSS overscroll-behavior-y Property

Definition and Usage

The overscroll-behavior-y property is used to turn off scroll chaining or overscroll affordance on an element when you try to scroll past the scroll boundary in y-direction.

Example

Result

Property Values

Value Description
auto Allows scroll chaining and overscroll affordance behavior. This is default
contain Allows overscroll affordance behavior, but not scroll chaining.
none Does not allow overscroll affordance or scroll chaining behavior.
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

CSS scroll-behavior Property

Definition and Usage

The scroll-behavior property specifies whether to smoothly animate the scroll position, instead of a straight jump, when the user clicks on a link within a scrollable box.

Example

Property Values

Value Description
auto Allows a straight jump “scroll effect” between elements within the scrolling box. This is default
smooth Allows a smooth animated “scroll effect” between elements within the scrolling box.
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit