Skip to content

Instantly share code, notes, and snippets.

@ariona
Created December 4, 2015 08:47
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 ariona/f399adf129ecc18af001 to your computer and use it in GitHub Desktop.
Save ariona/f399adf129ecc18af001 to your computer and use it in GitHub Desktop.
Minimal CSS to create background video
/*
* This method can be applied to video tag and
* can be applied to iframe video like youtube, but with some issue to be considered
*/
video{
/* Centering the video */
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
/* Below Props will stretch the video size */
min-width: 100%;
min-height: 100%;
/* Below props will keept the aspect ratio */
width: auto;
height: auto;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment