- Home
- /
- CSS Positioning
CSS Tutorial
Introduction
CSS Properties
CSS Designing
CSS Advance Topics
CSS FAQs
- Home
- /
- CSS Positioning
CSS Positioning
In web design, controlling where your elements appear on the page is crucial. CSS provides a powerful way to position elements exactly where you want them.
Using the position
property in CSS, you can change how elements behave within their containers and how they interact with others around them.
Let’s go through the different position values one by one.
Static (Default Position)
By default, every element on a webpage follows the natural document flow — top to bottom, left to right. This is called static
positioning.
You usually don’t need to set this manually, as it’s the default.
Syntax:
selector {
position: static;
}
Example:
Welcome to Learn With Arshyan!
Explore CSS in depth.
Start your journey today.
Stay consistent and keep learning!

This example shows that the image stays in the regular flow with no special positioning.
Relative
With relative
positioning, elements are placed based on their original position, but you can move them using top
, left
, right
, or bottom
.
It’s still part of the normal flow, so the space it originally occupied is preserved.
Syntax:
selector {
position: relative;
top: 30px;
left: 50px;
}
Example:
Learn With Arshyan - CSS Positioning
This image has been shifted from its default spot.

Notice: Even though the image is moved, its original space is not taken by any other element.
Absolute
An element with absolute
positioning is placed relative to its nearest ancestor that has a position value other than static
.
If there’s no such parent, it will position itself relative to the <html>
element (i.e., the whole page).
Also, it is removed from the normal flow of the document.
Example:
Learn With Arshyan
Welcome to your CSS journey.

Here, the .badge
image is positioned inside .container
at the top-right corner, independent of the text layout.
Fixed
A fixed
element is anchored to the screen itself, not to any container. It stays in place even when you scroll the page.
Perfect for sticky headers, footers, or floating buttons.
Example:
Learn With Arshyan

Now the header will remain at the top-right corner even if the page scrolls.
Float (Brief Overview)
While not part of the position
family, the float
property allows elements to shift to the left or right within a container.
It’s often used for wrapping text around images. For more on this, see the CSS Float lesson.
Sticky
The sticky
value is a smart mix between relative
and fixed
. The element behaves like relative
until a defined scroll position is reached, at which point it becomes fixed.
Example:
Sticky Heading
Scroll down to see this heading stick at the top.