CSS Overflow
The overflow property controls what happens to content that is too big to fit into an area.
The overflow property can have the following values:
visible: The default value. The content is not clipped and renders outside the element's box.hidden: The content is clipped, and the rest of the content will be invisible.scroll: The content is clipped, but a scrollbar is added to see the rest of the content.auto: Similar toscroll, but it adds scrollbars only when necessary.
Example: overflow: scroll
css
div.ex1 {
background-color: lightblue;
width: 110px;
height: 110px;
overflow: scroll;
}overflow-x and overflow-y
You can also control the overflow behavior for the horizontal (overflow-x) and vertical (overflow-y) axes independently.
Example
css
div {
overflow-x: hidden; /* Hide horizontal scrollbar */
overflow-y: scroll; /* Add vertical scrollbar */
}Test Yourself with an Exercise
Which overflow value adds a scrollbar only when necessary?