css3動(dòng)畫只循環(huán)一次用“animation-iteration-count”屬性設(shè)置,該屬性可以規(guī)定動(dòng)畫的執(zhí)行次數(shù),當(dāng)該屬性的值為1時(shí),可設(shè)置動(dòng)畫只循環(huán)一次;語法“元素{animation-iteration-count:1;}”。
本教程操作環(huán)境:windows7系統(tǒng)、CSS3&&HTML5版、Dell G3電腦。
css3動(dòng)畫只循環(huán)一次用animation-iteration-count
屬性設(shè)置。
animation-iteration-count屬性可以規(guī)定動(dòng)畫的執(zhí)行次數(shù),定義動(dòng)畫應(yīng)該播放多少次。
當(dāng)該屬性的值為1時(shí),可設(shè)置動(dòng)畫只循環(huán)一次。
示例:
<!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>
(學(xué)習(xí)視頻分享:css視頻教程、web前端)