I am not able to get the proper flip animation when I hover. I am not sure where I made mistake | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

I am not able to get the proper flip animation when I hover. I am not sure where I made mistake

https://sololearn.com/compiler-playground/WfN38j6E031P/?ref=app And I need the output only using keyframes

7th Feb 2024, 10:56 PM
susi
susi - avatar
8 Respuestas
+ 1
susi .card{...} should have position:relative, it is the container of .front and .back .card div{...} should have position:absolute, it is the same thing as .front, .back{...} in this use case. .card { width: 200px; height: 200px; position: relative; perspective: 1000px; } .card div { width: 100%; height: 100%; position:absolute; transition: transform 0.5s; }
8th Feb 2024, 11:12 PM
Bob_Li
Bob_Li - avatar
+ 1
hover the parent div. transform the child divs. use transition for animation. like this: https://sololearn.com/compiler-playground/Wle76EfEsu6q/?ref=app
8th Feb 2024, 2:29 PM
Bob_Li
Bob_Li - avatar
+ 1
Bob_Li why do we need such a high z-index ? And is it not possible to use only the @keyframe ?
8th Feb 2024, 4:14 PM
susi
susi - avatar
+ 1
you can use z-index of 1. I just use 10 in case I need to insert something in between The problem with using animation is you need to synchronize two animations. It feels like extra work to me. I will try it and post one if I can get it to work.
8th Feb 2024, 4:35 PM
Bob_Li
Bob_Li - avatar
+ 1
Bob_Li thank you so much
8th Feb 2024, 4:43 PM
susi
susi - avatar
+ 1
Bob_Li I am using grid layout but I am not getting the output correctly https://sololearn.com/compiler-playground/W3lo50qj5E2w/?ref=app
8th Feb 2024, 9:00 PM
susi
susi - avatar
+ 1
susi you can even get rid of .front, .back{ ..... } and merge it to .card div{...} .card div { width: 100%; height: 100%; position:absolute; transition: transform 0.5s; display: grid; place-items: center; color: white; font-weight: 800; backface-visibility: hidden; }
9th Feb 2024, 12:00 AM
Bob_Li
Bob_Li - avatar
0
# दो नंबरों को जोड़ने के लिए उपयोगकर्ता से इनपुट लें num1 = float(input("पहला नंबर दर्ज करें: ")) num2 = float(input("दूसरा नंबर दर्ज करें: ")) # दो नंबरों को जोड़ें result = num1 + num2 # नया नंबर को प्रिंट करें print(f"{num1} + {num2} = {result}")
9th Feb 2024, 2:29 AM
Kishan Verma
Kishan Verma - avatar