Can you use margin instead of top, left, right (position absolute)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can you use margin instead of top, left, right (position absolute)?

Margin:50% 50% 50% 50%; Instead of Position:absolute; top:50%; Left:50%;

6th Jan 2019, 3:58 PM
MceaLaif🇷🇴
MceaLaif🇷🇴 - avatar
4 Answers
+ 2
You looks succeed, but if there is content, your box shifted down. I added position: absolute; It's still relative, I further added top:0; and it goes up to margin-top:450px (count from body) My modified on yours: https://code.sololearn.com/WuOn8XlE7C5v/?ref=app
7th Jan 2019, 5:14 PM
Gordon
Gordon - avatar
+ 3
Interesting idea Did you try it in code playground? What result did you get?
6th Jan 2019, 5:43 PM
Gordon
Gordon - avatar
7th Jan 2019, 4:55 PM
MceaLaif🇷🇴
MceaLaif🇷🇴 - avatar
0
Gordon Thanks!!!!
9th Jan 2019, 6:54 AM
MceaLaif🇷🇴
MceaLaif🇷🇴 - avatar