XML technologies / CSS / Advanced websites with CSS / CSS property reference / overflow
(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)
The property overflow describes how the browser handles elements that are too large for their containing elements. In practice, this can happen when a parent element has a fixed or maximum height or width.
If overflow is applied to an element whose content is clipped, the element’s layout size is clipped as well. Decorations such as borders are applied only after clipping. This differs significantly from the property clip, which affects only an element’s visible area and clips borders and other decorations along with the content.
Inherited: no
See also: clip, height, text-overflow, max-width, max-height, width
Values
One of the following constants:
auto: This setting displays scrollbars when content overflows, allowing users to see the overflowing content. The scrollbars themselves occupy space within the element’s content area, reducing its visible area. Scrollbar sizes vary between browsers.hidden: This setting hides overflowing content.scroll: This setting behaves like the constantauto, but horizontal and vertical scrollbars appear even when they are not needed.visible: This setting allows overflowing content to appear outside the element’s visible box, including its background and border.
Default value: visible
Compatibility
CSS version: 2
Works in all CSS-capable browsers except Netscape 4, which always adjusts an element’s height to fit its content.
With the setting visible, Internet Explorer for Windows (through version 6) incorrectly expands the element’s box to fit the overflowing content instead of displaying it outside the box boundaries.
Internet Explorer 4 for Macintosh does not support scrollbars with the settings auto and scroll.
Example
The following style rule assigns a fixed height and width to the element with ID hauptmenue and creates scrollbars when content overflows:
#hauptmenue{
width: 150px;
height: 400px;
overflow: auto;
}
Copyright © 2006 of the German translation, dpunkt.verlag GmbH
You may print the online version for your private use.
Otherwise, this chapter from “CSS − Anspruchsvolle Websites mit Cascading Stylesheets” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19, 69115 Heidelberg