Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
What is Animation? | Animations
Advanced CSS Techniques
course content

Course Content

Advanced CSS Techniques

Advanced CSS Techniques

1. Introduction
2. Item Positioning
3. Transitions
4. Animations
5. Transformations
6. Adaptive/responsive websites and apps
7. Preprocessors

book
What is Animation?

Animations can create complex and dynamic effects to improve user interactive experience. Animations do not require a specific trigger event and can be set to repeat infinitely. Additionally, animations can have multiple intermediate states between the initial and final states, providing greater flexibility and control over the visual effects produced.

Create animation

We can create animations using the @keyframes rule, which defines a set of CSS styles at various points in an animation. Also, we set the name for the animation. It must be descriptive, that is, saying what kind of animation it is.

To determine the change of properties at a specific point in time, we can use the keywords: from (0%) and to (100%). Most often, the percentage values are used.

Once the animation has been declared, we can utilize the keyframes name as the value for the animation-name property across various elements. Another advantage of animations is that they can be applied repeatedly to multiple elements.

Practice

Let's add some animation to the div element. Our task is to change the background-color property in time. The initial state will be green, then at the 60% we need to make it red, and in the final state, we need blue. Additionally, we will specify the animation-duration property to notice the animation in work.

html

index

css

index

js

index

copy
What does the `@keyframes` rule allow doing?

What does the @keyframes rule allow doing?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 1
We're sorry to hear that something went wrong. What happened?
some-alt