+ 12

Difference between: margin-left and position:absolute/relative , left.

Are they interchangeable or there's an important (or less important) difference/s?

5th Nov 2018, 12:56 PM
voja
voja - avatar
3 Antworten
+ 3
margin-left Sets the amount of margin to the left of the element. left Sets the position of the element relative to the left most border of its parent element, and can only be used if relative (relative to parent element) or absolute (relative to whole page) positioning is used.
5th Nov 2018, 6:39 PM
Salma
Salma  - avatar
+ 1
The position attribute is used to place elements relative to others, so the left attribute describes how much you want it displaced from the left side of the screen/parent element. Margin-left describes how much space you want on the left side of the element between other elements and it is part of the CSS "Box Model" along with border and padding which you should research and learn as it is extremely handy for the layout of your pages.
5th Nov 2018, 9:00 PM
Lachlan
7th Jan 2019, 4:58 PM
MceaLaif🇷🇴
MceaLaif🇷🇴 - avatar