css - 当我添加视频标题 -chrome 时,背景不会保持固定

标签 css google-chrome

请看这里的背景效果:https://jsfiddle.net/xorkme75/embedded/result/

这里的背景是固定的。所以当你滚动页面时,你可以看到图像的其余部分。例如向下滚动,您可以看到女士的脸。

同时适用于 chrome 和 firefox。

*

但是当我将视频添加到页眉时。这种效果不再适用于 chrome。这是示例(请在 chrome 中查看):http://areafordemos.net63.net/chrome.html

我是怎么破解的?

我添加到 CSS:

#video-container {  
    top: 10%;
    width:100%;
    height:70%;
    overflow: hidden;
    z-index:-1; 
    }

video.fillWidth {
    width:100%;
    }

然后我添加到 HTML 中:

<div id="video-container">
    <video autoplay muted loop paused class="fillWidth">
        <source src="xhttp://demosthenes.info/assets/videos/polina.mp4" type="video/mp4"/>
        <source src="http://demosthenes.info/assets/videos/polina.webm" type="video/webm"/>
        Your browser does not support the video tag. I suggest you upgrade your browser.
    </video>
</div><!-- end video-container -->

splinter 区域的CSS代码:

.dzen_bg {
background-image: url('http://seventhqueen.com/themes/kleo/sensei-e-learning/wp-content/uploads/sites/6/2015/06/hero16.jpg'); 
background-size: 100% 100%;
background-repeat: no-repeat; 
background-position: 100% 12px; 
background-attachment: fixed;
padding-top: 10px; 
background-size: 100% 100%;
} 

例如,当我从 video.fillWidth 中删除 width: 100%; 时,效果又回来了,但视频看起来不像我想要的那样。所以我真的被困住了。

最佳答案

尝试将z-index:-2; 添加到.dzen_bg。因为我看到您在 #video-container 上有 z-index:-1;。我想它会解决你的问题。

关于css - 当我添加视频标题 -chrome 时,背景不会保持固定,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32023161/

相关文章:

HTML - 为什么隐藏 ="false"的元素不可见

css - 来自 materializecss 的 Roboto 在 Chrome、Firefox、IE 中呈现奇怪的字体?

css - 带有内部 overflow-x 元素的网格模板在 chrome 中中断了布局,但在 firefox 中没有

google-chrome - 在 Firefox 扩展中复制 Google Chrome 浏览器操作弹出效果

jquery - 使边框在悬停时淡入/淡出?

css - 边框选择器?

jquery - 替换绑定(bind)数组中的元素会在没有它的情况下短暂呈现它

javascript - jQuery event.preventDefault() 在 Firefox 中不起作用(包括 JSFiddle)

javascript - 从新标签中访问最多的部分删除网站

javascript - 隐藏/显示 div 轮廓