Home >Web Front-end >Front-end Q&A >Can css3 only implement animation once?

Can css3 only implement animation once?

WBOY
WBOYOriginal
2022-03-29 16:11:391921browse

css3 can not only implement animation once; you can use the "animation-iteration-count" attribute to define the number of animation playback times. When the attribute value is set to infinite, the number of playback times is unlimited, and the syntax is "animation- iteration-count:play count".

Can css3 only implement animation once?

The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.

css3 can only achieve one animation

css3 can only achieve one animation.

Just use animation-iteration-count.

The animation-iteration-count property defines how many times the animation should play. The default value is one.

Syntax

animation-iteration-count: value;
  • n A number that defines how many times the animation should be played

  • infinite Specifies that the animation should be played an infinite number of times ( Forever)

Examples are as follows:

<html>
<head>
<meta charset="utf-8"> 
<title>123</title> 
<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>
<p><strong>注意:</strong> Internet Explorer 9 及更早 IE 版本浏览器不支持 animation-iteration-count 属性。</p>
<div></div>
</body>
</html>

Output results:

Can css3 only implement animation once?

(Learning video sharing: css video tutorial)

The above is the detailed content of Can css3 only implement animation once?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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