【发布时间】:2014-04-06 02:43:00
【问题描述】:
我尝试使用 css 和 HTML5 制作全屏 HTML5 部分背景视频,发现很多文章,但并非所有文章都具有相同的概念。
问题是所有文章都用position: fixed;制作视频,使视频随你滚动。我需要找到一种方法来制作网站第一部分中的视频,例如 this site。
一般概念是:
http://demosthenes.info/blog/777/Create-Fullscreen-HTML5-Page-Background-Video
HTML:
<video autoplay loop poster="polina.jpg" id="bgvid">
<source src="polina.webm" type="video/webm">
<source src="polina.mp4" type="video/mp4">
</video>
CSS:
video#bgvid {
position: fixed; right: 0; bottom: 0;
min-width: 100%; min-height: 100%;
width: auto; height: auto; z-index: -100;
background: url(polina.jpg) no-repeat;
background-size: cover;
}
我做一个例子来测试你的 cmets 请检查here
【问题讨论】:
-
试试
position: absolute;? -
@Aditya 它使视频更小。抱歉不工作
标签: css html html5-video