I would like to create a full-screen video on my site, ideally using only HTML and CSS. I also need the video background to get stuck at the top of the page, so the first view of users is completely covered by the video, and then they can scroll down and move past the video.
I need the video to respond and maintain aspect ratio. However, in order to avoid black bars, I would like the video to fill 100% of which ever the size (width or height) was the smallest, and then transfer the video to another dimension.
This is my decision so far ...
<div class="container-fluid adjustedHeight">
<div class="video-container">
<div class="row">
<div class="col-md-12"></div>
</div>
<div class="row Page1">
<div class="col-md-6 button1">
<button type="button" class="btn btn-primary btn-lg outline">Pre-Order</button>
</div>
<div class="col-md-6 button2">
<button type="button" class="btn btn-primary btn-lg outline">About Us</button>
</div>
</div>
<video autoplay loop class="fillWidth">
<source src="Images/Comp 2.mp4" type="video/mp4" />
Your browser does not support the video tag. I suggest you upgrade your browser.</video>
<div class="poster hidden"> <img src="http://www.videojs.com/img/poster.jpg" alt=""> </div>
</div>
</div>
CSS
.video-container {
position: relative;
bottom: 0%;
left: -15px;
height: 100% !important;
width: 100vw;
overflow: hidden;
background: #000;
display: block !important;
}
.video-container video {
position: absolute;
z-index: 0;
bottom: 0;
}
.video-container video.fillWidth {
min-width: 100%;
min-height: 100%;
}
, , , .. . , , 100%? , min-height min-width , , 100%, , , ( doesn ). .video-container video.fillWidth CSS, , .
JSFiddle , ( , ), .
NB: bootstrap 3, adjustedheight .
EDIT:
, , JS, .
, , , , , - , ...
- ? JSFiddle , , ...