(Solved) How can i make my mountain img to go 20px below my top-container? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

(Solved) How can i make my mountain img to go 20px below my top-container?

I tried using margin bottom in negative value as well as the z-index property but unfortunately it's not working for me...need help https://code.sololearn.com/Wp46S4w7ny33/?ref=app

14th Aug 2020, 4:59 AM
Pawan
Pawan - avatar
7 Answers
+ 2
I didn't understand the question. You want to move mountain down by 20px? If so: .mountain{ /*other css properties*/ position: relative; top:20px; } Is this the effect you wanted?
14th Aug 2020, 5:07 AM
BlazingMagpie
BlazingMagpie - avatar
+ 1
Absolute removes the element from the tree, so it becomes relative to the screen. Then top:20px means image will be put at the top of the screen and then moved down by 20px. Relative just offsets the element from where it would be normally.
14th Aug 2020, 5:22 AM
BlazingMagpie
BlazingMagpie - avatar
0
BlazingMagpie Yes! It worked. Thank you so much.
14th Aug 2020, 5:11 AM
Pawan
Pawan - avatar
0
But why it wasn't working with position absolute may I know the reason?
14th Aug 2020, 5:17 AM
Pawan
Pawan - avatar
0
I got it now. Thanks once again
14th Aug 2020, 5:25 AM
Pawan
Pawan - avatar
0
Hi
15th Aug 2020, 2:51 PM
Rahul Vlogs
0
Hi
15th Aug 2020, 2:51 PM
Rahul Vlogs