Instance
To set the overflow property:
Div { width:150px; height:150px; overflow:scroll;
}
Try it yourself.
Browser support
All major browsers support the overflow property.
Note: The property value "Inherit" is not supported by any version of Internet Explorer (including IE8).
Definition and usage
The overflow property specifies what happens when the content overflows the element box.
Description
This property defines how the content of the overflow element's content area will be handled. If the value is scroll, the user agent provides a scrolling mechanism, whether or not it is required. Therefore, it is possible that scroll bars appear even if all the contents of the element box can be dropped.
Default value: |
Visible |
Inheritance: |
No |
Version: |
CSS2 |
JavaScript Syntax: |
object. style.overflow= "Scroll" |
Possible values
value |
Description |
Visible |
The default value. The content is not trimmed and is rendered outside the element box. |
Hidden |
The content is trimmed and the rest is not visible. |
Scroll |
The content is trimmed, but the browser displays scroll bars to see the rest of the content. |
Auto |
If the content is trimmed, the browser displays scroll bars to see the rest of the content. |
Inherit |
Specifies that the value of the overflow property should be inherited from the parent element. |
Tiy instances
-
How to use scroll bars to display content that overflows within an element
-
This example shows how to set an overflow property to specify a corresponding action when the element content is too large to exceed the specified area.
-
How to hide overflow content in overflow elements
-
This example shows how to set the overflow property to hide its contents when the content in the element is too large to fit within the specified range.
-
How to set up a browser to handle overflow automatically
-
This example shows how to set up a browser to handle overflows automatically.
Related pages
CSS Tutorial: CSS Positioning
HTML DOM Reference manual: Overflow properties
CSS Overflow Properties