JSFiddle - React, Tailwind, and code Playground
by Sampath_Madhuranga
HTML
<header id="home">
<div id="videoBackground">
<video loop="loop" playsinline="playsinline" autoplay="autoplay" muted="muted" poster="Images/posterImg.png" id="videoBackgroundVideo">
<source type="video/mp4" src="mov_bbb.mp4">
</video>
</div>
<h1> This is a title</h1>
<h2> This is a subtitle</h2>
<div id="welcomeMessage">
<h3> Welcome at <span>My Page</span></h3>
<img src="Images/LogoRoundWhite.png" id="homeLogoWhite" style="border-style:none;" />
</div>
</header>
CSS
header{
padding-top: 100px;
padding-bottom: 30px;
margin-top: 0px;
min-height: 400px;
text-align: center;
height: calc(100% - 257px);
justify-content: center;
overflow: hidden;
}
#videoBackground {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
z-index: -10;
}
#videoBackgroundVideo {
position: absolute;
top: 50%;
left: 50%;
width: auto;
height: auto;
min-width: 100%;
min-height: 100%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}