CSS overflow property
Example
Set different overflow property values:
div
.ex1
{
overflow:
scroll
;
}
div
.ex2
{
overflow:
hidden
;
}
div
.ex3
{
overflow:
auto
;
}
div
.ex4
{
overflow:
visible
;
}
Try it »
Property definition and usage
The overflow property specifies what happens if content overflows an element's box.
| Default value: | visible |
|---|---|
| Inherited: | no |
| Version: | CSS2 |
| JavaScript syntax: | object.style.overflow="scroll" |
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| overflow | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
**Note:** In X Lion (Mac OS), scrollbars are hidden by default and only appear when used (even if "overflow:scroll" is set).
Attribute 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. |
Related Articles
CSS Tutorial: CSS Positioning