Skip to content

Instantly share code, notes, and snippets.

@mujahidi
Last active November 23, 2021 21:06
Show Gist options
  • Save mujahidi/7a12382d633fb19724369e234dd197ff to your computer and use it in GitHub Desktop.
Save mujahidi/7a12382d633fb19724369e234dd197ff to your computer and use it in GitHub Desktop.
Vimeo background video inside container
<div class="video-container">
<div class="another-container">
<iframe src="https://player.vimeo.com/video/VIMEO-ID?background=1" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
</div>
<style>
.video-container{ height: 550px; overflow: hidden; }
.another-container{ height:0; overflow:hidden; position: relative; padding-bottom: 56.25%; /* 16:9 */ }
#mobile_video_container iframe{
position: absolute;
top: 0; /* change this to negative value to vertically center the video for larger screens e.g. -25% etc. */
left: 0;
width: 100%;
height: 100%;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment