【发布时间】:2018-07-13 15:54:11
【问题描述】:
我只在 Safari 中看到了这个问题,Chrome 和 Firefox 都可以根据需要工作。似乎在 Safari 中它正在加载 .video-container > 视频高度:100% 但不是宽度:100%。有没有人遇到过这个问题或知道可能的解决方案?
网站构建网址:http://betterbrands.3rfocuslabs.com
我的风格:
video#bgvid {
background: url(images/home/bg-video.jpg) no-repeat;
background-size: cover;
}
.video-container {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
}
.video-container > video {
display: block;
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 1;
}
@media screen and (max-aspect-ratio: 1920/1080) {
.video-container > video {
height: 100%;
}
}
@media screen and (min-aspect-ratio: 1920/1080) {
.video-container > video {
width: 100%;
}
}
我的代码:
<div class="video-container">
<video autoplay loop muted poster="<?php bloginfo('template_directory'); ?>/home/bg-video.jpg" id="bgvid">
<source src="<?php bloginfo('template_directory'); ?>/video/beer.mp4" type="video/mp4">
<source src="<?php bloginfo('template_directory'); ?>/video/beer.ogg" type="video/ogg">
<source src="<?php bloginfo('template_directory'); ?>/video/beer.webm" type="video/webm">
</video>
</div>
【问题讨论】:
-
谁能指出一个可能的解决方案?
标签: css video safari background