Skip to content

Instantly share code, notes, and snippets.

@JoelLisenby
Last active March 25, 2019 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoelLisenby/6e2136b824fd202c5755889da281d0ec to your computer and use it in GitHub Desktop.
Save JoelLisenby/6e2136b824fd202c5755889da281d0ec to your computer and use it in GitHub Desktop.
<div id="hero_video_container">
<video autoplay muted loop id="hero_video">
<source src="/videos/video.mp4" type="video/mp4" />
<source src="/videos/video.webm" type="video/webm" />
</video>
</div>
<style>
#hero_video_container {
position: relative;
width: 100%;
height: 75vh;
max-height: 75vw;
overflow: hidden;
background: transparent url('/images/placeholder.png') no-repeat center center;
background-size: cover;
}
video#hero_video {
display: none;
position: relative;
width: 100%;
height: 100vw;
object-fit: cover;
}
@media only screen and (min-width: 1024px) {
video#hero_video {
display: block;
height: auto;
}
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment