2017-05-31 73 views
0

其視頻背景,但它不工作... 這裏的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">

+0

您試圖更改哪種背景?請更具體一些。 – JSONGagnon

+0

要改變CSS中任何東西的背景顏色,使用'background-color:color value with unit',你已經完成了('background'是一個快捷方式屬性,它也可以工作)。如果這不起作用,那麼你必須檢查你的總體語法是否有錯誤。當然,您不能更改實際視頻的背景,因爲這是錄製的一部分。 –

+0

你是不是指'rgba(0,0,0,.50)'? – sol

回答

0

已使用的背景顏色設置RGBA不正確。

您有:

background: rgba(0, 0, 0, 50);

但對於RGBA的了Syntex是:

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)

您應用
0

邏輯沒關係買你需要改變:

RGBA(0,0,0,50);

到:

RGBA(0,0,0,0.50);

RGBA顏色值是帶有alpha通道的RGB顏色值的擴展名,它指定顏色的不透明度。 RGBA顏色值用rgba(紅色,綠色,藍色,alpha)指定。 alpha參數是0.0(完全透明)和1.0(完全不透明)之間的數字。