What attributes are used for css3 animation that only loops once?

青灯夜游
Release: 2022-03-18 15:46:01
Original
2514 people have browsed it

css3 animation only loops once and is set with the "animation-iteration-count" attribute. This attribute can specify the number of executions of the animation. When the value of this attribute is 1, the animation can be set to loop only once; the syntax "element {animation-iteration-count:1;}".

What attributes are used for css3 animation that only loops once?

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

css3 animation only loops once and is set with the animation-iteration-count property.

The animation-iteration-count attribute can specify the number of executions of the animation and define how many times the animation should be played.

When the value of this attribute is 1, the animation can be set to loop only once.

Example:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<style>
			div {
				width: 100px;
				height: 100px;
				background: red;
				position: relative;
				animation: mymove 3s;
				animation-iteration-count: 1;

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

			@keyframes mymove {
				0% {
					top: 0px;
				}

				50% {
					top: 200px;
				}
				100% {
					top: 0px;
				}
			}

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

		<div></div>

	</body>
</html>
Copy after login

What attributes are used for css3 animation that only loops once?

(Learning video sharing: css video tutorial, web front-end)

The above is the detailed content of What attributes are used for css3 animation that only loops once?. 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