How do i play then repeat a css animation? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do i play then repeat a css animation?

<div id="div"></div> #div{ width:10px; height:10px; animation:example 2s ease-in 0s 1 normal;} @keyframes example{ from{height:10px;} to{height:100px;}} how do i make this animation play once then repeat once in "reverse" direction with js?

11th Dec 2016, 2:20 AM
Foxtrot Pipe
Foxtrot Pipe - avatar
3 Answers
+ 10
replace "normal" in animation with "infinite". no js needed. this is how you do reverse: @keyframes example { 0%,100%{ height:0 0 10px ; } 50%{ height:0 0 100px ; } }
11th Dec 2016, 5:38 AM
Ahri Fox
Ahri Fox - avatar
4th May 2018, 6:26 AM
Nagarajk
Nagarajk - avatar
0
infinite
11th Dec 2016, 11:38 PM
Mahanny
Mahanny - avatar