我将我的 HTML 视频作为背景,上面有一些叠加层,但我遇到的问题是如何缩放视频。我的 . 上有一个设定的高度.videoSection
,但是当浏览器缩小到很小时,而不是像我想要的那样缩放和切断视频的末端,它只是重新缩放到更小的整体尺寸,同时在视频下方留下空白. 希望我足够清楚。这是我的 HTML:
<section class="topInfo1">
<div class="videoSection">
<video id="video-elem" preload="auto" autoplay="true" loop="loop" muted="muted">
<source src='/CMS_Static/Uploads/313864614C6F6F/C0071_1-1.mp4' type="video/mp4">
</video>
</div>
<div class="videoOverlay">
<div class="container">
<div class="row text-center">
<div class="col-md-8 col-md-offset-2">
<h1>Marketing the Boating and Marine Industry Through Video</h1>
</div>
<div class="col-sm-4 col-sm-offset-4">
<a class="btn topInfoBtn btn-block" href="/services">Learn More</a>
</div>
</div>
</div>
</div>
</section>
和 CSS
.videoSection {
position: relaltive;
width: 100%;
height: 650px;
overflow: hidden;
}
#video-elem {
width: 100%;
}
.videoOverlay {
background: rgba(0,0,0,0);
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
display: flex;
align-items: center;
justify-content: center;
}