Last active
January 13, 2016 07:40
-
-
Save vikrantnegi/e6c7a44a1aa6313a978e to your computer and use it in GitHub Desktop.
Responsive embedded video
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
.video-wrapper { | |
position: relative; | |
padding-bottom: 56.25%; | |
} | |
.video-wrapper iframe { | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
top: 0; | |
left: 0; | |
} | |
/* | |
To Calculate the padding %age do the following: | |
Given the video with an aspect ratio of 16:9 | |
padding-bottom: ((9/16) * 100) % | |
*/ |
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
<div class="video-wrapper"> | |
<iframe></iframe> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment