1
所以我用关键帧做了一个CSS动画,其中元素的背景颜色和字体颜色发生了变化。问题是,当涉及到最后一帧时,颜色会重置为默认值。我使用了animation-fill-mode
,它有助于保持最终尺寸,但颜色仍然重置?这是代码:保持CSS关键帧中的最后一个颜色变化
@keyframes anim{
0% {background-color: #404880; color: #DCE0F7;}
90% {background-color: #747AA6; color: #242D5E;}
100% {font-size: 19px;}
}
.apply{
font-size: 15px;
background-color: #404880;
border-radius: 5px;
border-style: none;
color: #DCE0F7;
}
.apply:hover{
animation: anim;
animation-duration: .5s;
-webkit-animation-fill-mode:forwards; /*Chrome 16+, Safari 4+*/
-moz-animation-fill-mode:forwards; /*FF 5+*/
-o-animation-fill-mode:forwards; /*Not implemented yet*/
-ms-animation-fill-mode:forwards; /*IE 10+*/
animation-fill-mode:forwards; /*when the spec is finished*/
}