Skip to main content

Position

Typeobject
Backlinks2

This property is used to control the positioning of an element within the document flow. The top, right, bottom, and left properties determine the final location of positioned elements.

PropertyTypeRequired
classstringRequired
valueintegerRequired

class​

Required

Type

string

Value

constant: the value of this property must be equal to:

"position"

value​

Required

Description

relative: The element is positioned according to the normal flow of the document, and then offset relative to itself based on the values of top, right, bottom, and left. The offset does not affect the position of any other elements; thus, the space given for the element in the page layout is the same as if position were static. absolute: The element is removed from the normal document flow, and no space is created for the element in the page layout. It is positioned relative to its closest positioned ancestor, if any; otherwise, it is placed relative to the initial containing block. Its final position is determined by the values of top, right, bottom, and left. fixed: The element is removed from the normal document flow, and no space is created for the element in the page layout. It is positioned relative to the initial containing block established by the viewport, except when one of its ancestors has a transform, perspective, or filter property set to something other than none (see the CSS Transforms Spec), or the will-change property is set to transform, in which case that ancestor behaves as the containing block. (Note that there are browser inconsistencies with perspective and filter contributing to containing block formation.) Its final position is determined by the values of top, right, bottom, and left. sticky: The element is positioned according to the normal flow of the document, and then offset relative to its nearest scrolling ancestor and containing block (nearest block-level ancestor), including table-related elements, based on the values of top, right, bottom, and left. The offset does not affect the position of any other elements.

Type

integer

Value

enum: the value of this property must be equal to one of the following values:

ValueExplanation
1
relative
2
absolute
3
fixed
4
sticky