Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

position

Description

The position property for CSS determines which of the positioning schemes is used to calculate the position of a box.

Syntax

CSS

position: value;

JS

object.style.position = "value";

Values

<'position'> = static | relative | absolute | sticky | fixed
static

The box is not a positioned box, and is laid out according to the rules of its parent formatting context.

relative

The box is laid out as static, then offset from the resulting position.

absolute

The box is positioned and sized solely in reference to its absolute positioning containing block. It is taken out of flow, meaning it has no impact on the size or position of its siblings and ancestors, and does not participate in its parent's formatting context.

sticky

Identical to relative, except that its offsets are automatically adjusted in reference to the nearest ancestor scroll container's scrollport in whichever axes the inset properties are not both auto, to try to keep the box in view within its containing block as the user scrolls.

fixed

Same as absolute, except the box is positioned and sized relative to a fixed positioning containing block.

Initial

static

Examples

1 · absolute

2 · fixed

3 · relative

4 · static

5 · sticky

6 · JS

HomeMenu