HTML XHTML The Complete Reference
home » reference » appendix b » css1 / css2 properties

position


This property defines how an element is positioned relative to other elements, using the values static, absolute, fixed, and relative. When positioned absolute, the left, right, top, and bottom properties define the element's precise location, using the affected element's upper-left corner (0,0) as reference. Because elements can contain other elements, 0,0 is not necessarily the upper-left corner of the browser window. When a relative position is used, offsets will be related to the object's natural position in the document flow. An element with absolute position will be set at the defined coordinates regardless to its position within the document, but will scroll with a window. An object with a fixed position will stay in position onscreen as things scroll. The default value static places elements according to the natural order in which they occur in a document.

Examples


span {position: relative; left: 190px; top: 30px;}
#div1 {position: absolute; left: 120px; top: 50px;}
#navbar {position:fixed; left: 0px; top: 0px;}

Browser and CSS Support Notes


CSS2
IE 4, 5, 5.5, 6
Nav 4, 4.5-4.8, 6, 7
Opera 4, 5, 6, 7

NOTE The fixed position value is not supported in Internet Explorer versions although it is supported in later versions of standards-compliant browsers such as Mozilla and Opera.

(X)HTML Elements
CSS Properties
Back: page-break properties Next: quotes
< Home | About | Chapters | Examples | Errata | Reference | Site Map >