+ 3

Positioning ?

Do you keep changing the position values to get the right position ?

1st Mar 2018, 11:28 AM
Amine Trabelsi
Amine Trabelsi - avatar
3 Answers
+ 7
position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); This rules will position any element vertically middle and horizontally center
10th Mar 2018, 10:20 AM
Kartikey Sahu
Kartikey Sahu - avatar
+ 3
i think it comes naturally with experience but basically its trial and redoing and testing
1st Mar 2018, 1:53 PM
Ahmed Alsoufy
Ahmed Alsoufy - avatar
+ 2
it is about aligning to a certain position. Ex: position:absolute; top:10px; right:80px; I chose these values randomly and I have no idea where the text or image will be so I run it then I keep changing it till it fits.
1st Mar 2018, 11:58 AM
Amine Trabelsi
Amine Trabelsi - avatar