Home > Web Front-end > CSS Tutorial > How to use the animation-iteration-count property

How to use the animation-iteration-count property

青灯夜游
Release: 2019-01-31 11:25:16
Original
4567 people have browsed it

The animation-iteration-count attribute is used to define the number of animation playback times. Setting the value of the animation-iteration-count attribute to infinite can achieve infinite loop playback of the animation.

How to use the animation-iteration-count property

CSS3 animation-iteration-count property

Function: animation- The iteration-count attribute defines the number of times the animation is played.

Syntax:

animation-iteration-count: n|infinite;
Copy after login

n: The value that defines the number of animation playback times.

infinite: Specifies that the animation should be played infinitely.​

Note: Internet Explorer 9 and earlier versions do not support the animation-iteration-count property.

Usage example of CSS3 animation-iteration-count property

Set animation loop 3 times

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:mymove 3s;
animation-iteration-count:3;

/* Safari and Chrome */
-webkit-animation:mymove 3s;
-webkit-animation-iteration-count:3;
}

@keyframes mymove
{
from {top:0px;}
to {top:200px;}
}

@-webkit-keyframes mymove /* Safari and Chrome */
{
from {top:0px;}
to {top:200px;}
}
</style>
</head>
<body>

<div></div>

</body>
</html>
Copy after login

Rendering:

How to use the animation-iteration-count property

The above is the entire content of this article, I hope it can help everyone learn Helps. For more exciting content, you can pay attention to the relevant tutorial columns of the PHP Chinese website! ! !

The above is the detailed content of How to use the animation-iteration-count property. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template