JSFiddle - React, Tailwind, and code Playground
by seadonk
HTML
<div class="before"></div>
<section id="banner">
<video id="videobcg" preload="auto" autoplay="true" loop="loop" muted="muted" volume="0">
<source src="https://static.lumosity.com/resources/home_page_templates/574/neuralnetwork.mp4" type="video/mp4">
<source src="movie.webm" type="video/webm">Sorry, your browser does not support HTML5 video.</video>
<p>This is text that is in front of video, we do not want the z-index of video to be greater than content. Hence background!</p>
</section>
<div class="after"></div>
CSS
.after, .before {
height:50px;
background-color: gray;
margin-top: 10px;
margin-bottom: 10px;
}
div, section {
border: 1px solid black;
box-sizing: border-box;
}
#banner {
position: relative;
height:300px;
width:100%;
overflow: hidden;
}
#videobcg {
position: absolute;
top: 0;
left: 0;
min-width: 100%;
min-height: 100%;
height:auto;
width:auto;
z-index: -100;
}