# CSS Position

> The CSS rule that sets where a box goes. It can stay in line, move, or stick in view.

**Field:** Software Development  
**Category:** Web Development  
**Also known as:** position Property, position: absolute, position: sticky, position: fixed

## Think of it like

It is like choosing where a sticker goes. In a row, on a corner, or stuck to the window.

## Definition

The CSS position property sets how an element is placed on the page. static is the default, and the box sits in the normal flow. relative nudges the box from where it would be. absolute takes the box out of the flow and pins it inside its nearest placed parent. fixed pins it to the window, so it stays put as you scroll. sticky scrolls along, then sticks at an edge.

## Example

Lucy wants a Chat button that stays in the corner while people scroll. She gives it position: fixed with bottom and right of 16px.

## Example code

```css
.chat { position: fixed; bottom: 16px; right: 16px; }
.menu { position: sticky; top: 0; }
```

The chat button stays in the corner. The menu scrolls up, then sticks to the top.

## Why it matters

Pop-ups, sticky menus and badges on pictures all use it. Most layout, though, is better done with flexbox or grid.

## Common mistake

Using absolute when the parent has no position set. The box then jumps to a far corner of the page.

## Three principles

- **static by default.** The box stays in the normal flow.
- **Pinned to a parent.** absolute needs a placed parent.
- **Pinned to the window.** fixed and sticky stay in view.

## Related terms

- [CSS Box Model](https://learn.benibix.com/term/development/css-box-model)
- [Flexbox](https://learn.benibix.com/term/development/flexbox)
- [CSS Grid](https://learn.benibix.com/term/development/css-grid)
- [Sticky Header](https://learn.benibix.com/term/design/sticky-header)
- [Cascading Style Sheets (CSS)](https://learn.benibix.com/term/development/css)

## Taught in

- [Flexbox, Grid and Position](https://learn.benibix.com/learn/development-web/flexbox-grid-and-position): HTML, CSS and JS, 9/14

![Five small page boxes, one per position value. Static: the box sits in the normal flow. Relative: the box is nudged from where it would be, leaving its old space empty. Absolute: the box is placed at a corner of its parent. Fixed: the box stays in the same spot of the window while the page scrolls. Sticky: the box scrolls, then sticks to the top edge.](https://learn.benibix.com/diagrams/dev5-css-position.svg)

---

Source: https://learn.benibix.com/term/development/css-position
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
