XML technologies / CSS / Advanced websites with CSS / CSS property reference / left
(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)
The property left describes the distance between the left edge of an element positioned with absolute (including padding, border and margin) and the left edge of the nearest ancestor whose property position has a value other than static. (Note: The CSS2 specification incorrectly states that padding, border and margin should be disregarded here. The CSS Working Group has already documented this error in the CSS2 errata.) If no such ancestor exists, the reference is the left edge of body.
For elements positioned with relative, the property left shifts the left edge relative to the element’s position without CSS positioning. A setting of 10px moves the element’s left edge 10 pixels to the right, while -10px moves it the same distance to the left.
Inherited: No
See also: position, bottom, top and right
Values
A CSS measurement, a percentage or the constant auto. Percentages are based on the parent element’s width. The constant auto instructs the browser to determine the left edge’s position automatically, taking other variables such as size and position into account.
Default value: auto
Compatibility
CSS version: 2
Works in all CSS-capable browsers, including Internet Explorer 4 and later, Netscape 4 and later, and Mozilla.
Example
The following style rule positions the element with ID menue 80% from the window’s left edge and gives it a width of 19.9%. Using 19.9% rather than exactly 20% avoids browser rounding errors that could produce a horizontal scrollbar.
#menue {
position: absolute;
left: 80%;
width: 19.9%;
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