css - 如何更改背景元素的CSS?

标签 css

在此页面上,我将视频下的一些元素设置为使用 CSS 在 15 秒后淡入。

问题是,在元素淡入之前,视频下方的背景是灰色的。

如何在我的元素完成褪色之前将灰色背景更改为白色(或者实际上是#F3F8FC)?我似乎找不到合适的 CSS 选择器来更改它。这是我正在使用的 CSS - 需要弄清楚如何更改隐藏元素背后的颜色:

    /* make keyframes that tell the start state and the end state of our object  */
@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.enroll {
    opacity:0;  /* make things invisible upon start */
    -webkit-animation:fadeIn ease-in 1;  /* call our keyframe named fadeIn, use animattion ease-in and repeat it only 1 time */
    -moz-animation:fadeIn ease-in 1;
    animation:fadeIn ease-in 1;

    -webkit-animation-fill-mode:forwards;  /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/
    -moz-animation-fill-mode:forwards;
    animation-fill-mode:forwards;

    -webkit-animation-duration:1s;
    -moz-animation-duration:1s;
    animation-duration:1s;
}

.enroll {
-webkit-animation-delay: 15s;
-moz-animation-delay: 15s;
animation-delay: 15s;
}

How to Change GREY to white

干杯。

最佳答案

Javascript 解决方案

您可以使用 javascript 代替 CSS。

function fadeIn(){
//code to fadeIn...
}

在 HTML 中你添加元素

<div id="bg" onload="setTimeout('fadeIn()', 15000)"></div>

CSS 解决方案

您可以使用背景:(这里有属性,例如颜色);
下面是示例:
背景:白色;

试试这个:
@keyframes fadeIn { from { opacity:0;background:(color-1); } 到 { 不透明度:1;背景:(颜色 2); }

关于css - 如何更改背景元素的CSS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36279409/

相关文章:

javascript - 在 mouseover 和 mouseout 中显示 li 中的按钮

javascript - 使用 getElementsByClass 时无法更改类

google-chrome - 打印预览中不显示背景颜色

css - 如何在 Svelte 中将 node_modules 中的 css 添加到 template.html

javascript - 如何删除任意框中上传的图片?

jquery - 单击操作在 'closed' 和 'open' 之间切换类时滑动切换

html - CSS 在聚焦时摆脱文本区域/选择中的蓝色轮廓

css - 带有 ui-bootstrap-tpls-0.13 和 bootstrap 3.3.2 的 Ui-bootstrap-modal,angular 1.3.14 不工作

javascript - 圆形进度条不是从中间开始

css - 具有绝对内部元素的相对文章 0px 高度