« 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.

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:hidden instead.
-moz-scrollbars-horizontal
Deprecated Use of overflow-x and overflow-y is preferred.
-moz-scrollbars-vertical
Deprecated Use of overflow-x and overflow-y is 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: hidden
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.

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.

See also

Tags (2)

Edit tags

Attachments (0)

 

Attach file