Name

position

Values:

static | relative | absolute | fixed | inherit

Initial value:

static

Applies to:

All elements.

Inherited:

No.

Computed value:

As specified.

Description:

This defines the positioning scheme used to lay out an element. Any element may be positioned, although elements positioned with absolute or fixed will generate a block-level box regardless of what kind of element it is. An element that is relatively positioned is offset from its default placement in the normal flow.

Examples:

#footer {position: fixed; bottom: 0;}
*.offset {position: relative; top: 0.5em;}

Supported by:

Firefox, Internet Explorer, Opera, Safari.

Note:

Fixed positioning is supported in Explorer only for versions 7 and later.

Get CSS Pocket Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.