它是用于视频背景的,但它不起作用...这里的html文件:
#player {
object-fit: inherit;
position: fixed;
z-index: -1;
height: 100%;
width: 100%;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 50);
}
<video autoplay loop class="player" id="player">
<source src="video.mp4" type="video/mp4">
您使用了背景颜色RGBA设置不正确。
您有:
background: rgba(0, 0, 0, 50);
但是rgba的征用是:
rgba(0, 0, 0, 0.50);
,您的代码应该看起来像:
#player {
object-fit: inherit;
position: fixed;
z-index: -1;
height: 100%;
width: 100%;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.50);
}
<video autoplay loop class="player" id="player">
<source src="video.mp4" type="video/mp4">
对不起,我的英语不好(我是荷兰人:P(
您应用的逻辑是可以更改:
rgba(0,0,0,50(;
to:
rgba(0,0,0,0.50(;
rgba颜色值是用alpha通道的RGB颜色值的扩展 - 指定颜色的不透明度。RGBA颜色值指定:RGBA(红色,绿色,蓝色,alpha(。alpha参数为0.0(完全透明(和1.0(完全不透明(。