2017-03-17 160 views

回答

0

隨着內容放置具有較低z-index的視頻,相應地定位內容。

video { 
 
z-index: 0; 
 
} 
 
h1 { 
 
z-index: 2; 
 
position: fixed; 
 
top: 20px; 
 
left: 40px; 
 
}
<video width="400" autoplay> 
 
    <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4"> 
 
    Your browser does not support HTML5 video. 
 
</video> 
 
<h1>Text</h1>

+1

請注意,'z-index'只有當它應用到的元素是一個定位元素時(即除'position:static'之外的任何東西,這是默認值)。 – GameGibu