[CSS] How to change properties on different elements in one keyframe animation? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

[CSS] How to change properties on different elements in one keyframe animation?

In animation, what I know is that you can only animate 1 element per keyframe. Is it possible to animate multiple elements in one keyframe?

28th Aug 2018, 3:24 AM
Email Not Activated
7 Answers
28th Aug 2018, 2:42 PM
Calviղ
Calviղ - avatar
+ 4
Mitali Can you help me with this?
28th Aug 2018, 3:56 AM
Email Not Activated
28th Aug 2018, 7:15 AM
Calviղ
Calviղ - avatar
+ 3
Hmmm.... Interesting question! 🤔 Can't wait for an answer.
28th Aug 2018, 5:48 AM
Paul Grasser
Paul Grasser - avatar
+ 2
Calviղ That's not what I meant. What I mean is how to animate multiple elements with only ONE keyframe. For example: There is 2 circles: Outer circle and Inner circle I want to animate the outer circle to change its background. Also, I want to animate the different background of inner circle. How would I do that with only ONE keyframe? Sample: @-webkit-keyframe change{ *How would I call the two elements to animate it here?* }
28th Aug 2018, 1:27 PM
Email Not Activated
+ 1
can someone teach me how to code? huhuhuhuu
29th Aug 2018, 1:38 AM
Kidrauhl
Kidrauhl - avatar
0
I'm not sure if you are asking is possible. In your case "change" is the animation-name, which you can use in different elements (in one or more elements). You do not call the elements inside the animation (in your case "change"). The way I understand, you create an animation then apply it to the element. //html <div></div> //css div { width: 100px; height: 100px; background-color: red; animation-name: colorchange; animation-duration: 1s; -webkit-animation-name: colorchange; -webkit-animation-duration: 1s; } @keyframes colorchange { 0% {background-color: red; } 50% {background-color: green; } 100% {background-color: blue; } } @-webkit-keyframes colorchange { 0% {background-color: red; } 50% {background-color: green; } 100% {background-color: blue; } }
29th Aug 2018, 11:54 AM
Dilan Livera
Dilan Livera - avatar