所以我制作了一个带有关键帧的 CSS 动画,其中元素的背景颜色和字体颜色发生变化。问题是,当到达最后一帧时,颜色会重置为默认颜色。我使用了它animation-fill-mode,它有助于保持最终尺寸,但颜色仍然重置?这是代码:
@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*/
}
Run Code Online (Sandbox Code Playgroud) 我想从Materialize动态更改导航栏的背景颜色,因此需要通过CSS完成.我试过了
.nav-wrapper{
background-color: <MYCOLOR HERE> !important;
}
Run Code Online (Sandbox Code Playgroud)
但它只是保持与导航栏类中提到的颜色相同.
我正在做一些我需要返回元素样式并在HTML页面中打印它的东西.好吧我知道如何打印它,但问题是如何获得元素.测试它是否会打印我试过的样式
console.log(document.getElementById('something').style.fontSize);
Run Code Online (Sandbox Code Playgroud)
但它返回undefined,即使'something'确实有一个设置的字体大小.