Last active
November 23, 2021 21:06
-
-
Save mujahidi/7a12382d633fb19724369e234dd197ff to your computer and use it in GitHub Desktop.
Vimeo background video inside container
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="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