Last active
July 14, 2022 14:18
-
-
Save snsxn/e0770863fc2544e7ea8c300e64b2de8c to your computer and use it in GitHub Desktop.
Full width and height video background CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.bg-video { | |
position: fixed; | |
z-index: -1; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
} | |
@media (min-aspect-ratio: 16/9) { | |
.bg-video video { | |
width: 100%; | |
height: auto; | |
} | |
} | |
@media (max-aspect-ratio: 16/9) { | |
.bg-video video { | |
width: auto; | |
height: 100%; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="bg-video"> | |
<video autoplay muted loop poster=""> | |
<source src="video.mp4" type="video/mp4"> | |
</video> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment