css3動畫只循環一次用什麼屬性

青灯夜游
發布: 2022-03-18 15:46:01
原創
2478 人瀏覽過

css3動畫只循環一次用「animation-iteration-count」屬性設置,該屬性可以規定動畫的執行次數,當該屬性的值為1時,可設定動畫只循環一次;語法「元素{animation-iteration-count:1;}」。

css3動畫只循環一次用什麼屬性

本教學操作環境:windows7系統、CSS3&&HTML5版、Dell G3電腦。

css3動畫只循環一次用animation-iteration-count屬性設定。

animation-iteration-count屬性可以規定動畫的執行次數,定義動畫應該播放幾次。

當該屬性的值為1時,可設定動畫只會循環一次。

範例:

<!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>
登入後複製

css3動畫只循環一次用什麼屬性

(學習影片分享:css影片教學web前端

以上是css3動畫只循環一次用什麼屬性的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!