+ 12
Difference between: margin-left and position:absolute/relative , left.
Are they interchangeable or there's an important (or less important) difference/s?
3 Answers
+ 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.
+ 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.
0
Is this an exemple ? https://code.sololearn.com/W6OgnJLuRm48/?ref=app