CSS Basic Tutorial
In CSS, the overflow
property controls how content is handled when it overflows the boundaries of its container. If the content inside an element is larger than the box it resides in, overflow
determines whether to clip, show, or provide scrollbars for the overflowing content.
overflow: visible | hidden | scroll | auto;
Value |
Description |
Effect |
---|---|---|
visible |
Content is not clipped and will be rendered outside the container if it overflows. |
The content may overlap other elements, depending on the layout. |
hidden |
Content that overflows the container is clipped (not visible), and no scrollbars are provided. |
Only the part of the content that fits within the container will be visible, and the rest is cut off. |
scroll |
Content is clipped, but scrollbars are added so users can scroll to see the rest of the content |
The container always shows scrollbars, even if the content does not overflow. |
auto |
If the content overflows, scrollbars are provided; otherwise, they are hidden. |
Scrollbars only appear when the content exceeds the container's bounds. |
Try it yourself
Currently Active Property:
These control the overflow behavior in the horizontal (overflow-x
) and vertical (overflow-y
) directions separately.
Try it yourself