Someone explain me @keyframe of css simply? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

Someone explain me @keyframe of css simply?

I can't understand keyframe topic

6th Apr 2020, 8:12 PM
Samira
Samira - avatar
7 Answers
+ 2
The @keyframes rule specifies the animation code. The animation is created by gradually changing from one set of CSS styles to another. During the animation, you can change the set of CSS styles many times. Specify when the style change will happen in percent, or with the keywords "from" and "to", which is the same as 0% and 100%. 0% is the beginning of the animation, 100% is when the animation is complete. To learn more, have a look at: https://www.sololearn.com/learn/CSS/2253/
6th Apr 2020, 8:47 PM
Bibek Oli
Bibek Oli - avatar
+ 3
Thanks bibek.But if there's written 0%, 50%, 100%.Then how can I write this by just 'from' and 'to'??
6th Apr 2020, 8:53 PM
Samira
Samira - avatar
+ 3
/* This is for CSS attchment */ @import url('https://fonts.googleapis.com/css?family=IBM+Plex+Sans:400i'); /* First Define Class */ .x { font-family: Ariel; text-align: center; width: 250px; height: 100px; color: #517034; background-color: #bbf783; animation: x 1s linear alternate; animation-iteration-count: infinite; } /* Then give it movement */ @keyframes x { 0% {transform: none;} 100% {transform: rotateY(180deg);} } /* HTML Code is below to see the effect <div class="x">Some Text</div> */ The same is mentioned in Jesus examples.
15th Jul 2020, 5:54 AM
Naveen Ahmad
+ 2
You can use both percentages or from-to in your animation. In using % you define every steps for your animation. By using from-to, you define starting and end point.Than the animation will run in that range till specified time. Have a look at examples of both at: https://code.sololearn.com/Wv1ox6JlRnFY/?ref=app
6th Apr 2020, 9:21 PM
Bibek Oli
Bibek Oli - avatar
+ 2
Thanks everyone
7th Apr 2020, 2:39 AM
Samira
Samira - avatar
+ 1
Ok I understand a bit
6th Apr 2020, 8:39 PM
Samira
Samira - avatar