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.

Note: The overflow property only works for block elements with a specified height.

Show different overflow property values:

div.ex1 {
  overflow: scroll;
}

div.ex2 {
  overflow: hidden;
}

div.ex3 {
  overflow: auto;
}

div.ex4 {
  overflow: visible;
}

CSS Syntax

overflow: visible|hidden|scroll|auto|initial|inherit;

Property Values

ValueDescription
visibleThe overflow is not clipped. It renders outside the element's box. This is default
hiddenThe overflow is clipped, and the rest of the content will be invisible
scrollThe overflow is clipped, but a scroll-bar is added to see the rest of the content
autoIf overflow is clipped, a scroll-bar should be added to see the rest of the content
initialSets this property to its default value. Read about initial
inheritInherits this property from its parent element. Read about inherit