css定位

"JavaScript: The Definitive Guide" 16.2.1

 

  • Static

This is the default value and specifies that the element is positioned according to
the normal flow of document content (for most Western languages, this is left to
right and top to bottom). Statically positioned elements cannot be positioned with
top, left, and other properties. To use CSS positioning techniques with a document
element, you must first set its position property to one of the other three
values.

 

  • Absolute

This value allows you to specify the position of an element relative to its containing
element. Absolutely positioned elements are positioned independently of all other
elements and are not part of the flow of statically positioned elements. An absolutely
positioned element is positioned either relative to its nearest positioned ancestor
or relative to the document itself.

 

  • Fixed

This value allows you to specify an element’s position with respect to the browser
window. Elements with fixed positioning are always visible and do not scroll with
the rest of the document. Like absolutely positioned elements, fixed-position elements
are independent of all others and are not part of the document flow. Fixed
positioning is supported in most modern browsers but is not available in IE6.

 

  • Relative

When the position property is set to relative, an element is laid out according to
the normal flow, and its position is then adjusted relative to its position in the
normal flow. The space allocated for the element in the normal document flow
remains allocated for it, and the elements on either side of it do not close up to fill
in that space, nor are they “pushed away” from the new position of the element.

posted @ 2014-08-07 07:56  小王子2013  阅读(188)  评论(0编辑  收藏  举报