CSS overflow property
Examples
Set the overflow property to scroll:
div
{
width:150px;
height:150px;
overflow:scroll;
}
{
width:150px;
height:150px;
overflow:scroll;
}
Attribute definitions and instructions
overflow property specifies if the content of an element overflow box, what will happen.
Defaults: | visible |
---|---|
inherit: | no |
version: | CSS2 |
JavaScript syntax: | object .style.overflow = "scroll" |
Browser Support
Figures in the table represent the first browser to support the version number of the property.
属性 | |||||
---|---|---|---|---|---|
overflow | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
Note: X Lion (Mac OS), the scroll bar is hidden by default show only when in use (even if "overflow: scroll" is set).
Property Value
value | description |
---|---|
visible | Defaults. Content will not be pruned, it will appear outside the box element. |
hidden | Content will be trimmed, and the remaining content is not visible. |
scroll | Content will be trimmed, but the browser will display a scroll bar to view the rest of the content. |
auto | If the content is trimmed, the browser will display a scroll bar to view the rest of the content. |
inherit | Provisions should inherit the property value overflow from the parent element. |
related articles
CSS tutorial: CSS Positioning