Position

Positioning in CSS provides designers and developers options for positioning HTML elements on a web page.

The CSS position can be set to static, relative, absolute, or fixed or sticky.

Position

bottom
Specifies the distance of an element from the bottom of its current location if the element itself has position: relative declared or from the bottom of its nearest ancestor when the ancestor has position: relative and the element has position: absolute declared.
left
Specifies the distance of an element from the left of its current location if the element has position: relative declared or from the left of its nearest ancestor when the ancestor has position: relative and the element has position: absolute declared.
position
Defines the location of an element.
right
Specifies the distance of an element from the right of its current location if the element has position: relative declared or from the right of its nearest ancestor when the ancestor has position: relative and the element has position: absolute declared.
top
Specifies the distance of an element from the top of its current location if the element has position: relative declared or from the top of its nearest ancestor when the ancestor has position: relative and the element has position: absolute declared.
z-index
Sets the stack order of an element.

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn CSS on Codecademy