html - 通过 CSS 的视频背景覆盖 Wordpress 上的页脚

标签 html css wordpress background html5-video

我的公司正在使用 Wordpress;我找到了一些有用的代码来将视频作为背景,我们很高兴它在我们的网络浏览器上加载的速度有多快。不幸的是,此背景显示在页脚的顶部,因此页脚不再可见。我以两种方式插入了 html 代码:1. 在 Visual Composer 中使用“原始 html”字段,2. 通过 Wordpress 文本编辑器插入 html 代码。正如我提到的,代码运行良好,但它覆盖了页脚。 这是页面的位置:http://gathereducation.com/homepage-html-5-video/ .

这是 html、CSS 和 JS:

HTML:

<video autoplay loop poster="/wp-content/uploads/2015/03/student_pov.jpg" id="bgvid">
<source src="/wp-content/uploads/2015/03/HomepageBannerNewClass.webm" type="video/webm">
<source src="/wp-content/uploads/2015/03/HomepageBannerNewClass.mp4" type="video/mp4">
</video>

CSS:

video { display: block; }

video#bgvid {
position: fixed;
top: 50%;
left: 50%;
min-width: 100%; min-height: 100%;
width: auto; height: auto; 
z-index: -100;
background: url(/wp-content/uploads/2015/02/student_pov.jpg) no-repeat;
background-size: cover;
transform: translateX(-50%) translateY(-50%);
}

@media screen and (max-device-width: 800px) {
.content { background: url(http://gathereducation.info/wp-content/uploads/2015/02/student_pov.jpg) #000 no-repeat center center fixed; }
#bgvid { display: none; }
}

原始 JS:

<!--[if lt IE 9]>
<script>
document.createElement('video');
</script>
<![endif]-->

有谁知道如何解决这个问题?我想我了解导致问题的原因,但我无法找出将页脚显示在背景下方的最佳方式 - 而不是在背景下方。

谢谢!

最佳答案

只需在页脚中添加一个 z-index。

footer {
  z-index: 100;
}

在 Chrome 中工作得非常棒。

关于html - 通过 CSS 的视频背景覆盖 Wordpress 上的页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28969222/

相关文章:

javascript - 为什么我的 JavaScript 代码中的选择器函数不起作用?

javascript - 使用 JavaScript 或 Jquery 自动完成输入文本

javascript - ionic 框架,在渲染模板后加载一个javaScript

mysql - 通过 WordPress 设置远程 MySQL 数据库连接时出错 - 可能的解决方案

php - 循环遍历 PHP 中的字母表,将字母分组为 A-C、C-E 等范围

regex - WordPress 重定向插件不区分大小写的正则表达式

jquery - 单击超链接时将 div 设置为不透明度 0

html - 我用 ejs 修复了一个奇怪的语法错误,我想知道问题是什么

css - 透明PNG/GIF雕刻出背后的背景图

jquery - 删除 jQuery 中的内联 CSS