【发布时间】:2014-04-15 07:45:59
【问题描述】:
我有一个固定位置的视频和几个固定背景附件的 div。 在 Firefox 和 IE 中一切正常,但在 chrome 中,背景图像显示效果不佳。
HTML:
<video class="sleep-video" autoplay>
<source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
<source src="http://www.w3schools.com/html/mov_bbb.ogg" type="video/ogg">
</video>
<div class="section one"></div>
<div class="section two"></div>
<div class="section three"></div>
CSS:
body, html {
padding: 0;
margin:0;
height: 100%;
}
.section {
width: 100%;
height: 100%;
background-attachment: fixed;
background-size: 100% 100%;
position: relative;
background-color: white;
z-index: 2;
}
.section.one,
.section.three {
background-image: url(http://www.maximumpc.com/files/u160391/chrome_0.png);
}
.section.two {
background: none;
}
.sleep-video {
left: 0;
top: 0;
position: fixed;
width: 100%;
z-index: 1;
}
我绝对需要为图像固定背景附件,因为我的网站使用视差效果。目前,我使用的解决方法是在不需要时隐藏视频,但这远非理想。
【问题讨论】:
标签: css html google-chrome html5-video