I am currently working on a page where I have a video as the background above the fold, spanning 100% width. My goal is to position the video close to the center of the page. I thought setting the height using vh would be the best option. However, I ran into an issue on larger screens where the video's height increases along with its width, causing the bottom of the video to get cut off.
Here is the CSS code I am using:
.container {
position: relative;
margin-top: 20vh;
}
.video {
opacity: .2;
width: 100vw;
vertical-align: middle;
height: auto;
}
Is there a way to determine the actual height of the video so that I can adjust the padding at the top accordingly? Or perhaps there is a simpler solution that I haven't considered?
Thank you!
Edit to add HTML Here is the HTML code for reference:
<div class="container">
<video autoplay muted loop class="video">
<source src="./media/MockUpVid.mp4" type="video/mp4"/>
</video>
</div>