What are the different values of the position property in CSS?
The position property has five values.
| Value | Meaning |
|---|---|
static | Default, normal flow |
relative | Offset from its normal place, the space stays reserved |
absolute | Placed against the nearest positioned parent, removed from the flow |
fixed | Placed against the browser window, stays while scrolling |
sticky | Normal until a scroll point, then sticks |
.parent { position: relative; }
.badge { position: absolute; top: 0; right: 0; }
See CSS Position.
Learn more about the similar topics:
| Tutorials |
|---|
| CSS Layout – The display Property |
| CSS Position Property |
| CSS z-index |
| CSS Float and Clear Property |
| Exercises & Assignments |
|---|
| Write CSS to centre a box horizontally using margin auto |
| Write CSS to create a horizontal navigation menu |