XML technologies / CSS / Advanced websites with CSS / CSS property reference / bottom
(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)
The property bottom specifies the distance between the bottom edge of an element positioned with absolute (including padding, border and margin) and the bottom edge of its containing block. (Note: the CSS2 specification contains an error stating that padding, border and margin should be ignored in this context. The CSS Working Group has already documented this error in the CSS2 errata.) The element is aligned with the nearest ancestor whose property position has a value other than static. If there is none, it is aligned with the element body.
If positioning is calculated relative to the element body, Internet Explorer for Windows, Netscape 6 and Mozilla position the element relative to the bottom edge of the browser window (before scrolling), rather than the bottom edge of the entire document as the CSS specification requires. Internet Explorer 5 for Macintosh correctly positions elements relative to body.
For elements positioned with the value relative, bottom shifts the element relative to the position it would occupy without CSS positioning. For example, a value of 10px moves the element 10 pixels upward, while -10px moves it downward.
Inherited: no
See also: position, left, top and right
Values
A CSS length, a percentage or the constant auto. Percentages are based on the parent element’s height. The constant auto tells the browser to determine the position itself, taking other variables such as size and position into account.
Default value: auto
Compatibility
CSS version: 2
Works in Internet Explorer version 5 and later, Netscape version 6 and later, and all Mozilla versions.
The same effect can be achieved with the property top. Since top is supported by more browsers than bottom, its use is recommended.
Example
The following style rule positions the HTML element with ID menue at the bottom of the browser window, or at the bottom of the document in Internet Explorer for Macintosh:
#menue {
position: absolute;
bottom: 0;
width: 100px;
height: 200px;
}
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