Skip to content

Instantly share code, notes, and snippets.

@tyidnet
Created June 7, 2021 18:07
Show Gist options
  • Save tyidnet/4564bb5db8c1a612d3b5c44820277a4b to your computer and use it in GitHub Desktop.
Save tyidnet/4564bb5db8c1a612d3b5c44820277a4b to your computer and use it in GitHub Desktop.
<style>
body { margin: 0; }
.vimeo-container {
padding: 0;
width: 100%;
height: 100vh;
overflow: hidden;
position: relative;
}
iframe {
box-sizing: border-box;
width: 177.77777778vh;
height: 56.25vw;
min-width: 100%;
min-height: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
</style>
<div class="vimeo-container">
<iframe src="https://player.vimeo.com/video/[videoId]?api=1&background=1&autoplay=1&loop=1" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
</div>
@Jhongt796
Copy link

4 years later this is still a great trick, I've been looking at the best way to do this for a few hours, a reddit forum sent me here, thanks!

@rogue-hacker
Copy link

thank you thank you thank you, I've been trying to do this myself for so many years. you are a hero!

@codeway
Copy link

codeway commented Mar 19, 2025

Thanks you for the share 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment