CSS2 » Properties » position

Version: Level 2

Compability: IE4+  N4+

Syntax:
position : absolute | fixed | relative |static
static
The static value dictates that an element will be positioned as it occurs in the normal flow of the display of the page.
relative
The relative value moves the element an offset distance relative to the position it has in the normal flow of the display of the page.
fixed
The fixed value is related to the absolute value, except that the element is positioned absolutely with respect to the browser window, rather than the page. This means that the element should remain in the same position even when the page is scrolled.
absolute
The absolute value allows an element to be placed anywhere on a page. The position is set using the bottom, left, right, or top properties.

The position property is one of two properties that can be used to set the physical position of an element in terms of where and how it will appear on a page. The other positioning property is float. This property is not inherited.

These two properties allow you to select among the three possible positioning schemes in CSS, which are:

  • normal flow The elements are displayed in the normal order that they occur.
  • floats The element is shifted to the right or left. Other elements, such as text, can optionally flow around the side.
  • absolute positioning The element is offset a specified distance with respect to the position it has in the normal flow.
The position property can be used in conjunction with the bottom, left, right, and the top properties.

Examples

Code:
position: absolute;
bottom: 1in;
left: 1in;
right: 1in;
top: 1in;
}
Language(s): CSS2

See Also: