Created
July 9, 2014 13:29
-
-
Save ruffle1986/2cc08cde41283dbba2ae to your computer and use it in GitHub Desktop.
A CSS technique to keep 16:9 aspect ratio in the case of responsive video elements. ".video" refers to the video html element.
This file contains hidden or 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
.player-wrapper { | |
position: relative; | |
width: 100%; | |
height: 0; | |
padding-bottom: percentage(9 / 16); | |
border: 1px solid black; | |
.video { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: auto; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I hope you'll find it "+1".