【发布时间】:2020-02-03 09:56:16
【问题描述】:
我想创建一个覆盖整个屏幕的视频容器
并且容器内的视频覆盖整个容器并且不溢出意味着容器适应整个屏幕尺寸。
并做出相应的反应。
目前视频正处于全高度..我不想要那个
我希望它的高度限制在屏幕大小并且没有滚动。
我的html代码是
<div class="video-container">
<div class="video-wrapper">
<video autoplay controls>
<source src="../../assets/movies/joker.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
</div>
</div>
我的css代码是:
.video-container {
display: block;
max-width: 100%;
min-width: 200px;
}
.video-wrapper {
background: #000;
border-radius: inherit;
overflow: hidden;
position: relative;
z-index: 0;
}
.video-container video {
border-radius: inherit;
height: auto;
vertical-align: middle;
width: 100%;
}
video {
max-width: 100%;
object-fit: contain;
}
请帮我解决这个问题..提前谢谢。
【问题讨论】:
-
尝试在 vh 和 vw 中搜索 css
标签: html css html5-video