Table of contents
- 1. Summary
- 2. Syntax
- 3. Values
- 3.1. Mozilla Extensions
- 4. Examples
- 5. Notes
- 6. Browser compatibility
- 7. Specifications
- 8. See also
« CSS « CSS Reference
Summary
The overflow CSS property specifies whether to clip content, render scroll bars or display overflow content of a block-level element.
- Initial value
:
visible - Applies to: block and inline-block elements, table cells
- Inherited : no
- Media:
visual - Computed value : as specified
Syntax
overflow: visible | hidden | scroll | auto | inherit
Values
- visible
- Default value. Content is not clipped, it may be rendered outside the content box.
- hidden
- The content is clipped and no scrollbars are provided.
- scroll
- The content is clipped and desktop browsers use scrollbars, whether or not any content is clipped. This avoids any problem with scrollbars appearing and disappearing in a dynamic environment. Printers may print overflowing content.
- auto
- Depends on the user agent. Desktop browsers like Firefox provide scrollbars if content overflows.
Mozilla Extensions
- -moz-scrollbars-none
-
Obsolete Use
overflow:hiddeninstead. - -moz-scrollbars-horizontal
-
Deprecated
Use of
overflow-xandoverflow-yis preferred. - -moz-scrollbars-vertical
-
Deprecated
Use of
overflow-xandoverflow-yis preferred. - -moz-hidden-unscrollable
- Is intended mainly for internal use and by themes. Disables scrolling of XML root elements and
<html>,<body>by arrow keys and mouse wheel.
Examples
p {
width: 12em;
border: dotted;
overflow: auto; /* append scrollbars if necessary */
}
overflow: scroll
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: auto
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
overflow: auto
short text
visible (default)
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
Notes
Through Gecko 1.9.2 (Firefox 3.6), the overflow property is incorrectly applied to table-group elements (<thead> , <tbody> , <tfoot>). This behavior is corrected in later versions.
Browser compatibility
| Browser | Lowest version |
|---|---|
| Internet Explorer | 4.0 [*] |
| Firefox (Gecko) | 1.0 (1.0) |
| Opera | 4.0-7.0 |
| Safari (WebKit) | 1.0 (85) |
[*] IE 4-6 enlarges an element with overflow:visible (default value) to fit the content in it. height/width behaves like min-height/min-width.
Specifications
See also
- Related CSS properties:
text-overflow,white-space,overflow-x,overflow-y,clip,display


Mozilla Developer Network