CSS
HTML
JavaScript
jQuery
PHP
SQL
WordPress
CSS Reference

Quick Reference

The @keyframes rule defines the animation timeline, which gradually changes from one set of CSS styles to another.

The @keyframes rules specifies when the style changes 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 has completed.

Moving an Element

				
					@keyframes my_animation {
    from {
        top: 0px;
    }
    to {
        top: 500px;
    }
}
				
			
				
					@keyframes my_animation {
    0%   {
        top: 0px;
    }
    25%  {
        top: 500px;
    }
    50%  {
        top: 250px;
    }
    75%  {
        top: 500px;
    }
    100% {
        top: 0px;
    }
}
				
			

Changing Multiple CSS Values

				
					@keyframes my_animation {
    from {
        top: 0px;
        background: red;
    }
    to {
        top: 500px;
        background: blue;
    }
}
				
			

Values

These are the allowed values.

ValueDescription
animationnameDefines the name of the animation (required)
keyframes-selectorPercentage of the animation duration (required)
  • 0-100%
  • from (same as 0%)
  • to (same as 100%)
css-stylesOne or more legal CSS style properties (required)

We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.

CSS
HTML
JavaScript
jQuery
PHP
SQL
WordPress

Why 1SMARTchicken?

This site was built and is maintained to benefit my autistic son.
See More →

My Son's Name is Johnny

He was diagnosed as autistic quite late, at age four...
His story

Buy Me a Coffee

Thanks for your support!

Feedback

If you see an error on the page or the code itself is incorrect or incomplete, or just plain wrong, please let us know. We’re always learning. NOTE: we do not sell your information and will not send you spam emails.