Skip to content

Instantly share code, notes, and snippets.

@coopermayne
Created December 13, 2016 22:28
Show Gist options
  • Save coopermayne/f8b7d94560d6cc786c721882633217e5 to your computer and use it in GitHub Desktop.
Save coopermayne/f8b7d94560d6cc786c721882633217e5 to your computer and use it in GitHub Desktop.
CSS trick for getting a well centered video background to a div
.video_contain {
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
}
video {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
margin: auto;
min-height: 50%;
min-width: 50%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment