设计要求:有一张iPhone的背景图片,上面有一个循环播放视频的视频标签。所有与这个问题相关的答案都是将视频标签绝对放在图像背景之上。但在调整窗口大小时会出现问题。

发布于 2019-09-25 18:57:47
无需在图像上放置绝对视频标记也是可能的,这将有助于提高响应速度,同时为此目的更改窗口size.Check、下面的css和html代码。
<div id="tv_container">
<video autoplay muted loop>
<source src="http://commondatastorage.googleapis.com/gtv-videos-
bucket/sample/ForBiggerBlazes.mp4" type="video/mp4">
</source>
</video>
</div>
#tv_container {
background-image: url('../img/mobile-no-send.png');
width: 24%;
background-size: 100% 100%;
position: relative;
background-repeat: no-repeat;
padding-left: 1.8%;
padding-right: 1.6%;
padding-bottom: 5%;
padding-top: 3.3%;
}
video {
max-width:100%;
max-height:100%;
position: relative;
overflow: hidden;
object-fit: fill;
border-radius: 2%;
}https://stackoverflow.com/questions/58096499
复制相似问题