What is the concept of relative and absolute used in CSS? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

What is the concept of relative and absolute used in CSS?

9th Jul 2018, 6:41 AM
Sam
Sam - avatar
2 Antworten
+ 3
✔ Nicely described on CSS course: https://www.sololearn.com/learn/CSS/1114/
9th Jul 2018, 6:59 AM
Sudarshan Rai
Sudarshan Rai - avatar
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; }
9th Jul 2018, 11:50 AM
James
James - avatar