From the course: CSS Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

The position property

The position property - CSS Tutorial

From the course: CSS Essential Training

The position property

- [Presenter] The position property is a technique used to position elements by changing the flow of the document. It has five values, static, relative, absolute, fixed, and sticky. The default position for elements is static, which means they are not positioned. For the other values, the box offset properties, top, right, bottom, and left must also be used to specify the placement of the positioned elements. Let's use a code pen example to see how these position values work. Starting with relative positioning, scroll down to the relative class and uncomment the position relative style. We won't see any changes yet because relative is the only positioned element that stays in the normal layout flow. So none of the surrounding elements will be affected either but all positioned elements can be moved using the offset properties. A top value of 20 pixels will offset the element 20 pixels from the top of its current…

Contents