Home >Web Front-end >CSS Tutorial >How to use the animation-name attribute in CSS3
Usage of animation-name attribute in CSS3: [animation-name: keyframename|none]. This attribute is used to specify a name for the @keyframes animation.
##css3 animation-name attribute
Function: animation The -name attribute specifies the name for the @keyframes animation.
Syntax:
animation-name: keyframename|none;keyframename: Specifies the name of the keyframe that needs to be bound to the selector. none: Specifies no animation effect (can be used to override animations from the cascade).
Note: The animation-duration attribute must always be set, otherwise when the duration is 0, the animation will not be played.
css3 animation-name attribute usage example
<!DOCTYPE html> <html> <head> <style> div { width:100px; height:100px; background:red; position:relative; animation-name:mymove; animation-duration:5s; /* Safari and Chrome */ -webkit-animation-name:mymove; -webkit-animation-duration:5s; } @keyframes mymove { from {left:0px;} to {left:200px;} } @-webkit-keyframes mymove /* Safari and Chrome */ { from {left:0px;} to {left:200px;} } </style> </head> <body> <p><strong>注释:</strong>Internet Explorer 9 以及更早的版本不支持 animation-name 属性。</p> <div></div> <p><b>注释:</b>始终规定 animation-duration 属性,否则时长为 0,就不会播放动画了。</p> </body> </html>Rendering:
The above is the detailed content of How to use the animation-name attribute in CSS3. For more information, please follow other related articles on the PHP Chinese website!