CSS The overflow Property

CSS overflow Property

The overflow property controls what happens when content is larger than its box.

Used when text, images, or elements overflow their container.


 1. overflow: visible; (Default)

Content overflows outside the box.



 2. overflow: hidden;

Extra content is cut off (not visible).



 3. overflow: scroll;

Always shows scrollbars (even if not needed).


 4. overflow: auto;

Shows scrollbars only if needed (best option).



 5. overflow-x and overflow-y

Control horizontal and vertical overflow separately.



📌 Example (Common Usage)

If content is larger, scrollbars appear automatically.


⭐ Summary Table

Value Behavior
visible Content overflows outside
hidden Extra content is clipped
scroll Always shows scrollbars
auto Scrollbars only if needed

You may also like...