Skip to content

Instantly share code, notes, and snippets.

@jasco
Created January 23, 2021 06:18
Show Gist options
  • Save jasco/0164478c85f19dda3b4921c6fd7a071b to your computer and use it in GitHub Desktop.
Save jasco/0164478c85f19dda3b4921c6fd7a071b to your computer and use it in GitHub Desktop.
HTML Video Background #html #web
.vid_bg {
position: absolute;
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
pointer-events: none;
transition: display .3s;
-webkit-transition: display .3s;
}
.vid_backdrop {
position: absolute;
max-width: none;
left: 50%;
}
.vid_backdrop * {
box-sizing: border-box;
}
.vid_mediael {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 0;
}
<!-- reference https://github.com/mediaelement/mediaelement -->
<div style="position: relative; overflow: hidden;"}>
<div class="vid_bg">
<div class="vid_backdrop" tabindex="0" role="application" aria-label="Video Player" style="width: 1202px; height: 676.125px; min-width: 0px; margin: 0px 0px 0px -601px;">
<div class="vid_mediael">
<mediaelementwrapper>
<video loop="loop" autoplay="" playsinline="" muted="" preload="none" src="https://myurl.local/public/intro.mp4" style="margin: 0px; width: 1202px; height: 676.125px;">
<source type="video/mp4" src="https://myurl.local/public/intro.mp4">
</video>
</mediaelementwrapper>
</div>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment