CSS Layout - Overflow
The CSS overflow property controls how content is displayed when it overflows an element's box.
The text content here is scrollable, and the scrollbar direction is vertical.
The text content here is scrollable, and the scrollbar direction is vertical.
The text content here is scrollable, and the scrollbar direction is vertical.
The text content here is scrollable, and the scrollbar direction is vertical.
The text content here is scrollable, and the scrollbar direction is vertical.
The text content here is scrollable, and the scrollbar direction is vertical.
CSS Overflow
The CSS overflow property can control adding a scrollbar within the corresponding element area when content overflows the element's box.
The overflow property has the following values:
| Value | Description |
|---|---|
| visible | Default. Content is not clipped and is rendered outside the element's box. |
| hidden | Content is clipped, and the rest of the content is invisible. |
| scroll | Content is clipped, but the browser displays scrollbars to view the rest of the content. |
| auto | If content is clipped, the browser displays scrollbars to view the rest of the content. |
| inherit | Specifies that the overflow property should be inherited from the parent element. |
**Note:** The overflow property only works on block elements with a specified height.
Note: On OS X Lion (Mac), scrollbars are hidden by default and only appear when used (the same applies when setting "overflow:scroll").
overflow: visible
By default, the value of overflow is visible, which means content overflows the element's box:
The text content here overflows the element's box.
The text content here overflows the element's box.
The text content here overflows the element's box.
The text content here overflows the element's box.
The text content here overflows the element's box.
The text content here overflows the element's box.
The text content here overflows the element's box.
Example
div
{
width:
200
px
;
height:
50
px
;
background-color:
#eee
;
overflow:
visible
;
}
Try it »