animation-name

CSS animation-name Property

The animation-name property specifies one or more names of animations defined by the @keyframes rule which should be applied to the selected element. When multiple comma-separated values are specified for any animation property, they will be attached to the animations that are defined in animation-name differently.

The animation-name property is one of the CSS3 properties.

The animation shorthand property can be used to set all animation properties at once. Different animation properties can control the animation. They can specify the iteration time of the animation, whether the animation should be playing or paused and whether it alternates between the values. The start time of the animation can also be delayed.

类目类目
Initial Valuenone
Applies toAll elements. It also applies to ::before and ::after pseudo-elements.
InheritedNo.
AnimatableNo.
VersionCSS3
DOM Syntaxobject.style.animationName = “element”;

Syntax

Syntax

animation-name: keyframename | none | initial | inherit;

Example of the animation-name property:

<!DOCTYPE html>
<html>
  <head>
    <style>
      div {
        padding: 50px;
        animation: element 4s infinite;
      }
      @keyframes element {
        0% {
          background-color: #8ebf42;
        }
        50% {
          background-color: #1c87c9;
        }
        100% {
          background-color: #d5dce8;
        }
      }
    </style>
  </head>
  <body>
    <h2>Animation-name example</h2>
    <div>The name of the animation is set as "element".</div>
  </body>
</html>

In the given example the name of animation is set to “element”. You can choose any name you want.

Values

Values

ValueDescription
noneThis is default value. Specifies that there will be no animation
keyframenameSpecifies the name of animation.
initialIt makes the property use its default value.
inheritIt inherits the property from its parents element.


请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部