【发布时间】:2015-01-05 05:31:27
【问题描述】:
我正在尝试制作带有视频背景的标题。我在 html 中插入了一个视频,并在 css 中使视频的 z-index -100。
目前它在谷歌浏览器中运行良好,但如果我在 safari 中打开我的网站,视频背景的位置完全错误。
我无法解决这个问题,所以两个浏览器都会显示相同的内容。
可以在这里看到网站:http://www.chatroom.guru
这是我的html:
<header>
<video autoplay loop poster="polina.jpg" id="bgvid">
<source src="/img/headerbgvideo.mp4" type="video/mp4" id="bgvid">
</video>
<div class="container">
<p id="title1">Connect with the world today!</p>
<p id="title2">Join the world's best social chatroom for gamers.</p>
这是我的 CSS:
video#bgvid {
position: absolute;
margin-top: -90px;
width: 100%;
z-index: -100;}
希望有人可以帮助我! 谢谢
【问题讨论】:
-
您是否有任何特殊原因需要绝对定位您的视频?我认为您可以离开视频并绝对定位您的
.container。 (但要小心定位正确的.container) -
感谢您的评论。我仍然无法让它工作......
标签: html css video background header