Positioning

Positioning elements is something we spend a lot of our time on when building sites and applications, so having a good understanding of how to place an element on a layout is crucial, especially when an element can have different positions depending on the available space.

Let's see what positioning is all about.

position

The position CSS property defines the location of an element.

Description

There are five keyword values for the position property: static, absolute, relative, fixed, and sticky.

static

This is the default value of the position property. The element stays in the flow of the document and appears in the actual location where it's located in the markup.

absolute

The element is removed from the document flow and it's positioned ...

Get Web Developer's Reference Guide 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.