+ 1
What is the concept of relative and absolute used in CSS?
4 Respostas
+ 3
✔ Nicely described on CSS course:
https://www.sololearn.com/learn/CSS/1114/
0
When you make a HTML document, it will automatically assign everything a spot.
Then you can add some CSS for left, margin-left, or other positioning values/properties, to move it from the automatically assigned position.
On relative positioning (default usually), any positioning values are added to its default coordinates.
On absolute positioning, the element is moved to the beginning of its parent element (like if the parent was empty and other elements can't get in the way), then positioning values are applied from there.
It can also have fixed positioning, so the values you enter are the exact coordinates of it on the page (besides the document's margins). And there are a few other options you can look up.
Here's an example of some CSS:
p{
position: relative;
left: 50 px;
top: 100px;
}