The CSS overflow property controls what happens to content that is too big to fit into an area.
The overflow
property specifies whether to clip the content or to add scrollbars when the content of an element is too big to fit in the specified area.
By default, the overflow is visible
, meaning that it is not clipped and content renders outside the element's box:
With the hidden value, the overflow is clipped, and the rest of the content is hidden:
Setting the value to scroll
, the overflow is clipped and a scrollbar is added to scroll inside the box. Note that this will add a scrollbar both horizontally and vertically (even if you do not need it):
The auto
value is similar to scroll
, but it adds scrollbars only when necessary:
The overflow-x
and overflow-y
properties specify whether to control the overflow of content horizontally or vertically.
overflow-x handles overflow on the left/right (horizontal) edges of the content.
overflow-y handles overflow on the top/bottom (vertical) edges of the content.