Html 更改 html5 视频元素的背景颜色

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19974902/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 15:18:43  来源:igfitidea点击:

Change background-color of html5 video element

csshtmlhtml5-video

提问by user809829

I've got the following website: beta.leifsigersen.com

我有以下网站:beta.leifsigersen.com

There's a movie on the front page which sometimes takes a little while to load (sometimes less than a second, sometimes a few seconds). Before the movie is loaded there's black background/borders. How can I change the color of this?

首页上有一部电影有时需要一点时间来加载(有时不到一秒钟,有时几秒钟)。在加载电影之前,有黑色背景/边框。我怎样才能改变这个的颜色?

I've tried to use CSS of the video-element, but without any luck.

我尝试使用视频元素的 CSS,但没有任何运气。

采纳答案by mahega

Try this CSS:

试试这个 CSS:

.pk_video {
     background-color: red !important; /* or whatever you want */
}

回答by Sabba Keynejad

So i had this annoying white bar, I got rid of it using. I applied it the the containing div.

所以我有这个烦人的白色条,我用它摆脱了它。我将它应用于包含的 div。

background-color: transparent;

Alternatively use

或者使用

 background-color: rgba(0, 0, 0, 0);

Hope that helps

希望有帮助

回答by Fuller93

Just add the background color to the html code itself. For example:

只需将背景颜色添加到 html 代码本身即可。例如:

<video width="100%" height="100%" style="background-color: #fff;" src=""></video>