您好,登錄后才能下訂單哦!
這篇文章主要介紹css中animation-fill-mode屬性的使用方法,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
animation-fill-mode 屬性規(guī)定動(dòng)畫在播放之前或之后,其動(dòng)畫效果是否可見。
注釋:其屬性值是由逗號(hào)分隔的一個(gè)或多個(gè)填充模式關(guān)鍵詞。
語法
animation-fill-mode : none | forwards | backwards | both;
值 | 描述 |
none | 不改變默認(rèn)行為。 |
forwards | 當(dāng)動(dòng)畫完成后,保持最后一個(gè)屬性值(在最后一個(gè)關(guān)鍵幀中定義)。 |
backwards | 在 animation-delay 所指定的一段時(shí)間內(nèi),在動(dòng)畫顯示之前,應(yīng)用開始屬性值(在第一個(gè)關(guān)鍵幀中定義)。 |
both | 向前和向后填充模式都被應(yīng)用。 |
實(shí)例
為 h2 元素規(guī)定填充模式:
<!DOCTYPE html> <html> <head> <style> div { width:100px; height:100px; background:red; animation:myfirst 5s; animation-fill-mode: forwards; -moz-animation:myfirst 5s; /* Firefox */ -webkit-animation:myfirst 5s; /* Safari and Chrome */ -o-animation:myfirst 5s; /* Opera */ } @keyframes myfirst { from {background:red;} to {background:yellow;} } @-moz-keyframes myfirst /* Firefox */ { from {background:red;} to {background:yellow;}
以上是css中animation-fill-mode屬性的使用方法的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。