This page will be very useful in custom home page layout as a Hero Block when you have a video URL and want to use that as the background, while having Text and Call-To-Action elements overlaid on top.
<style><!--
.video-bg-container {
position: relative;
width: 100%;
height: 80vh; /* or whatever height you want */
overflow: hidden;
background: #000; /* fallback color */
margin-bottom: 25px;
}
.video-bg-container .video-bg {
position: absolute;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: 0;
transform: translate(-50%, -50%);
object-fit: cover; /* ensures it fills the div properly */
filter: brightness(0.6); /* optional darken */
}
.video-bg-container .video-overlay {
position: relative;
z-index: 1; /* above video */
color: #fff;
text-align: center;
padding: 10% 5%;
}
.video-bg-container .video-overlay h1 {
font-size: 3rem;
font-weight: 700;
margin-bottom: 1rem;
}
.video-bg-container .video-overlay p {
font-size: 1.25rem;
margin-bottom: 1.5rem;
}
--></style>
<div class="video-bg-container"><video width="300" height="150" autoplay="autoplay" muted="" loop="loop" playsinline="" class="video-bg">
<source src="https://d1c2851ymfarr0.cloudfront.net/images/X001-000019/dark_cinematic_background.mp4" type="video/mp4" />
</video>
<div class="video-overlay">
<h1>Welcome to Hockeysyte</h1>
<p>Real-time stats. Real passion.</p>
<a href="https://proteux.sportsyte.com/signup" class="button">Get Started</a></div>
</div>
Comments
0 comments
Please sign in to leave a comment.