CSS 参考CSS 选择器CSS 听觉参考手册CSS Web 安全字体组合CSS 动画CSS 单位CSS 颜色CSS 合法颜色值CSS 颜色名称CSS 颜色 十六进制值CSS 函数CSS align-content 属性CSS align-items 属性CSS align-self 属性CSS all 属性CSS 3 animation (动画) 属性CSS 3 animation-delay 属性CSS 3 animation-direction 属性CSS 3 animation-duration 属性CSS 3 animation-fill-mode 属性CSS 3 animation-iteration-countCSS 3 animation-name 属性CSS 3 animation-play-state 属性CSS 3 animation-timing-functionCSS 3 appearance 属性CSS 3 backface-visibility 属性CSS background 属性CSS background-attachment 属性CSS background-blend-mode 属性CSS 3 background-clip 属性CSS background-color 属性CSS background-image 属性CSS 3 background-origin属性CSS background-position 属性CSS background-repeat 属性CSS 3 background-size 属性CSS border 属性CSS border-bottom属性CSS border-bottom-color 属性CSS 3 border-bottom-left-radiusCSS 3 border-bottom-right-radiusCSS border-bottom-style 属性CSS border-bottom-width 属性CSS border-collapse 属性CSS border-color 属性CSS 3 border-image 属性CSS 3 border-image-outset 属性CSS 3 border-image-repeat 属性CSS 3 border-image-slice 属性CSS 3 border-image-source 属性CSS 3 border-image-width 属性CSS border-left 属性CSS border-left-color 属性CSS border-left-style 属性CSS border-left-width 属性CSS 3 border-radius 属性CSS border-right 属性CSS border-right-color 属性CSS border-right-style 属性CSS border-right-width 属性CSS border-spacing 属性CSS border-style 属性CSS border-top 属性CSS border-top-color 属性CSS 3 order-top-left-radius 属性CSS 3 border-top-right-radius 属性CSS border-top-style 属性CSS border-top-width 属性CSS border-width 属性CSS bottom 属性CSS 3 box-align 属性CSS 3 box-direction 属性CSS 3 box-flex 属性CSS 3 box-flex-group 属性CSS 3 box-lines 属性CSS 3 box-ordinal-group 属性CSS 3 box-orient 属性CSS 3 box-pack 属性CSS 3 box-shadow 属性CSS 3 box-sizing 属性CSS caption-side 属性CSS clear 属性CSS clip 属性CSS color 属性CSS 3 column-count 属性CSS 3 column-fill 属性CSS 3 column-gap 属性CSS 3 column-rule 属性CSS 3 column-rule-color 属性CSS 3 column-rule-style 属性CSS 3 column-rule-width 属性CSS 3 column-span 属性CSS 3 column-width 属性CSS 3 columns 属性CSS content 属性CSS counter-increment 属性CSS counter-reset 属性CSS cursor 属性CSS direction 属性CSS display 属性CSS empty-cells 属性CSS 3 filter(滤镜) 属性CSS flex 属性CSS flex-basis 属性CSS flex-direction 属性CSS flex-flow 属性CSS flex-grow 属性CSS flex-shrink 属性CSS flex-wrap 属性CSS float 属性CSS font 属性CSS 3 @font-face 规则CSS font-family 属性CSS font-size 属性CSS 3 font-size-adjust 属性CSS 3 font-stretch 属性CSS font-style 属性CSS font-variant 属性CSS font-weight 属性CSS 3 grid-columns 属性CSS 3 grid-rows 属性CSS 3 hanging-punctuation 属性CSS height 属性CSS 3 icon 属性CSS justify-content 属性CSS 3 @keyframes 规则CSS left 属性CSS letter-spacing 属性CSS line-height 属性CSS list-style 属性CSS list-style-image 属性CSS list-style-position 属性CSS list-style-type 属性CSS margin 属性CSS margin-bottom 属性CSS margin-left 属性CSS margin-right 属性CSS margin-top 属性CSS max-height 属性CSS max-width 属性CSS 3 @media 查询CSS min-height 属性CSS min-width 属性CSS 3 nav-down 属性CSS 3 nav-index 属性CSS 3 nav-left 属性CSS 3 nav-right 属性CSS 3 nav-up 属性CSS 3 opacity 属性CSS order 属性CSS outline 属性CSS outline-color 属性CSS 3 outline-offset 属性CSS outline-style 属性CSS outline-width 属性CSS overflow 属性CSS 3 overflow-x 属性CSS 3 overflow-y 属性CSS padding 属性CSS padding-bottom 属性CSS padding-left 属性CSS padding-right 属性CSS padding-top 属性CSS page-break-after 属性CSS page-break-before 属性CSS page-break-inside 属性CSS 3 perspective 属性CSS 3 perspective-origin 属性CSS position 属性CSS 3 punctuation-trim 属性CSS quotes 属性CSS 3 resize 属性CSS right 属性CSS 3 rotation 属性CSS3 rotation-point 属性CSS tab-size 属性CSS table-layout 属性CSS 3 target 属性CSS 3 target-name 属性CSS 3 target-new 属性CSS 3 target-position 属性CSS text-align 属性CSS text-align-last 属性CSS text-decoration 属性CSS text-decoration-color 属性CSS text-decoration-line 属性CSS text-decoration-style 属性CSS text-indent 属性CSS 3 text-justify 属性CSS 3 text-outline 属性CSS 3 text-overflow 属性CSS 3 text-shadow 属性CSS text-transform 属性CSS 3 text-wrap 属性CSS top 属性CSS 3 transform 属性CSS 3 transform-origin 属性CSS 3 transform-style 属性CSS 3 transition 属性CSS 3 transition-delay 属性CSS 3 transition-duration 属性CSS 3 transition-property 属性CSS 3 transition-timing-functionCSS unicode-bidi 属性CSS vertical-align 属性CSS visibility 属性CSS white-space 属性CSS width 属性CSS word-spacing 属性CSS 3 word-wrap 属性CSS z-index 属性CSS 3 text-emphasis 属性CSS 3 overflow-style 属性

CSS 3 animation-fill-mode 属性

css animation-fill-mode属性规定当动画不播放时(当动画完成时,或当动画有一个延迟未开始播放时),要应用到元素的样式

默认情况下,CSS 动画在第一个关键帧播放完之前不会影响元素,在最后一个关键帧完成后停止影响元素 animation-fill-mode 属性可重写该行为

默认值:none
继承:
可动画化:
版本:CSS3
JavaScript 语法object.style.animationFillMode="forwards" 

语法

animation-fill-mode: none|forwards|backwards|both|initial|inherit;


属性值

描述
none默认值。动画在动画执行之前和之后不会应用任何样式到目标元素
forwards在动画结束后(由 animation-iteration-count 决定),动画将应用该属性值
backwards动画将应用在 animation-delay 定义期间启动动画的第一次迭代的关键帧中定义的属性值。这些都是 from 关键帧中的值(当 animation-direction 为 "normal" 或 "alternate" 时)或 to 关键帧中的值(当 animation-direction 为 "reverse" 或 "alternate-reverse" 时)
both动画遵循 forwards 和 backwards 的规则。也就是说,动画会在两个方向上扩展动画属性
initial设置该属性为它的默认值
inherit从父元素继承该属性


浏览器支持

下表中的数字表示支持该属性的第一个浏览器版本号。

紧跟在 -webkit-, -ms- 或 -moz- 前的数字为支持该前缀属性的第一个浏览器版本号。

ChromeIEFirefoxSafariOpera
4.0 -webkit-10.016.0
5.0 -moz-
4.0 -webkit-15.0 -webkit-
12.1
12.0 -o-

范例

把物体动画地从一个地方移动到另一个地方,并让它停留在那里

animation-fill-mode:forwards;
-webkit-animation-fill-mode:forwards; /* Safari 和 Chrome */

链接: https://www.fly63.com/course/6_270