0

How to prevent an element from changing its position like given in this code. Checkout code.

https://code.sololearn.com/WXzQPlUl5rQd/?ref=app

6th Jun 2022, 6:54 PM
Predaking Askboss
13 Answers
+ 2
Just remove position:absolute; from line 56 and 57. It's enabling overlapping.
6th Jun 2022, 8:24 PM
Adil
Adil - avatar
+ 2
Adil, there is still one issue! Checkout first div and second div. First div is given absolute and the second is not. Why the first div not overlapping over second div even though we are using absolute attribute in first div?
6th Jun 2022, 10:12 PM
Predaking Askboss
+ 2
No Problem 😊 Always happy to help 🤠
7th Jun 2022, 2:03 PM
Adil
Adil - avatar
+ 1
Please use the tags "html" next time, it's much more meaninful.
6th Jun 2022, 8:33 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 1
Adil, as much i understand position absolute doesn't enable overlapping instead it removes them from flow. That's why the last <div> didn't postition down from the second last <div>. And overlapping is like normal feature of elements but static positioning or normal flow prevents it from happening. And thanks cause your comment was helpful in finding my solution. I replaced position with margin.
6th Jun 2022, 8:53 PM
Predaking Askboss
+ 1
Yup! You're right. That's what I meant. Actually position absolute removes elements from their normal flow which results in overlapping. That's my pleasure 🙌 It's nice that you've found the solution. Happy Coding 🤠
6th Jun 2022, 9:16 PM
Adil
Adil - avatar
+ 1
You've set position absolute in div1 animation not in div1 entirely. Try setting it after line 3.
7th Jun 2022, 6:05 AM
Adil
Adil - avatar
+ 1
Finally i got it. It was a complex code for me. Giving absolute positioning in animation gave such a confusing result. Thanks for your time
7th Jun 2022, 12:09 PM
Predaking Askboss
0
🤨what does that mean Chaverra McCallop?
7th Jun 2022, 9:44 PM
Predaking Askboss
0
Ok
7th Jun 2022, 9:48 PM
Chaverra McCallop
0
Chad
8th Jun 2022, 7:07 AM
Gamergoose55
Gamergoose55 - avatar
0
It is better to use transform:translate( x, y) for such positioning
22nd Jun 2022, 6:04 AM
Predaking Askboss
- 2
Hi How arw dat
7th Jun 2022, 8:41 PM
Chaverra McCallop