我需要在包含HTML 5视频的div的div顶部叠加一个div。在下面的示例中,重叠div的ID为“ video_overlays”。请参见下面的示例:
<div id="video_box">
<div id="video_overlays"></div>
<div>
<video id="player" src="http://video.webmfiles.org/big-buck-bunny_trailer.webm" type="video/webm" onclick="this.play();">Your browser does not support this streaming content.</video>
</div>
</div>
<div id="video_box">
<div id="video_overlays"></div>
<div>
<video id="player" src="http://video.webmfiles.org/big-buck-bunny_trailer.webm" type="video/webm" onclick="this.play();">Your browser does not support this streaming content.</video>
</div>
</div>
为此,您只需要像这样添加css:
#video_overlays { position: absolute; background-color: rgba(0, 0, 0, 0.46); z-index: 2; left: 0; right: 0; top: 0; bottom: 0; } #video_box{position: relative;}