Contents
Specifying element position
By using the position CSS property, you can define how a certain HTML element is positioned in the document:
The syntax for CSS position property
To define the element's position in CSS, you need to choose one out of five available values:
position: value;
The default value is static which means the position of the element depends on the flow of the document. All the available values are explained in the table below.
Pros Main Features
- Easy to use with a learn-by-doing approach
- Offers quality content
- Gamified in-browser coding experience
- The price matches the quality
- Suitable for learners ranging from beginner to advanced
- Free certificates of completion
- Focused on data science skills
- Flexible learning timetable
Pros Main Features
- Simplistic design (no unnecessary information)
- High-quality courses (even the free ones)
- Variety of features
- Nanodegree programs
- Suitable for enterprises
- Paid Certificates of completion
Pros Main Features
- A wide range of learning programs
- University-level courses
- Easy to navigate
- Verified certificates
- Free learning track available
- University-level courses
- Suitable for enterprises
- Verified certificates of completion
Property values for CSS positioning
| Value | Description |
|---|---|
static |
The default value. The position of the element depends on the flow of the document and cannot be specified using top, bottom, left and right |
absolute |
The position of the element is relative to the closest positioned parent or the initial container |
fixed |
The position of the element is relative to the document and not affected by scrolling |
relative |
The position of the element depends on the flow of the document, but can be specified using top, bottom, left and right |
sticky |
Works like position: relative; until a specified scroll location is reached, then sticks to a fixed position |
Browser support
Chrome
1+
Edge
12+
Firefox
1+
IE
4+
Opera
4+
Safari
1+
Mobile browser support
Chrome
18+
Firefox
4+
Opera
All
Safari
All