HTML Academy
Previous task
Animations1/32
  • Hello, animation!
  • @keyframes: storyboard
  • @keyframes: from and to
  • @keyframes: frame grouping
  • Complex animation, step 1
  • Complex animation, step 2
  • Water adventure
  • Animation play count: animation-iteration-count
  • Animation direction: animation-direction, step 1
  • Animation direction: animation-direction, step 2
  • Animation delay: animation-delay, step 1
  • Animation delay: animation-delay, step 2
  • Animation delay: animation-delay, step 3
  • Air journey
  • Pre- and post-animation state: animation-fill-mode, step 1
  • Pre- and post-animation state: animation-fill-mode, step 2
  • Pre- and post-animation state: animation-fill-mode, step 3
  • Pre- and post-animation state: animation-fill-mode, step 4
  • Pre- and post-animation state: animation-fill-mode, step 5
  • Launching a factory, step 1
  • Launching a factory, step 2
  • Stopping and starting an animation: animation-play-state
  • Animation form, animation-timing-function
  • Animation-timing-function, step 2
  • Animation-timing-function, step 3
  • Animation-timing-function, step 4
  • Rocket to the launch pad, step 1
  • Rocket to the launch pad, step 2
  • Landing, step 1
  • Landing, step 2
  • Landing, step 3
  • Keep exploring!
@keyframes: storyboard
  • Theory
  • Theory

Hello, animation!

Welcome to our CSS Animation course curious CSS explorer! We will walk the evolution path of a civilization and conquer deep space. We will move, rotate and transform objects while learning the basics of object animation in CSS. For practice in animations go to the first task, for other free interactive courses in HTML, CSS, and JavaScript go to htmlacademy.org! 🚀


CSS enables you to to create complex animations and control them in a number of ways. A description of a CSS animation consists of two parts: a set of @keyframes and animation parameters.

Here is a sample description of the keyframes of an animation:

@keyframes stretching {
  0% {
    width: 100px;
  }
  100% {
    width: 200px;
  }
}

The animation in this example is called stretching and describes how a block’s style will change from the initial to the final point. This animation can be applied to any element. All you need to do is to add two properties to your CSS: animation-name (name of your animation) and animation-duration (duration) and define the corresponding values. For example:

.button {
  animation-name: stretching;
  animation-duration: 1s;
}

This code will assign the stretching animation to all elements of the button class. As a result, the element will be gradually stretched horizontally from 100px to 200px in 1s.

  • index.html
  • style.css
HTML
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
CSS
1
2
/*
@keyframes rotate {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
100%
GoalsCompleted 0 out of 2

Uncomment in CSS:

  1. description of the keyframes of the @keyframes rotate animation;
  2. rule for the .wood-wheel class.

Сookies ∙ Personal Data ∙ Made with ❤︎ in HTML Academy