Created
April 30, 2015 19:55
-
-
Save jonalvarezz/11f2d7e90b14508dbc62 to your computer and use it in GitHub Desktop.
Fluid iframe video wrapper
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
# Fluid Video Wrapper | |
Make videos fluid and keep video proportion | |
## Markup | |
Padding top style attribute is calculated. | |
```html | |
<div class="fluid-width-video-wrapper" style="padding-top: 59%"> | |
<iframe ...></iframe> | |
</div> | |
``` | |
# Style | |
```css | |
.fluid-width-video-wrapper { | |
width: 100%; | |
position: relative; | |
padding: 0; | |
} | |
.fluid-width-video-wrapper iframe, | |
.fluid-width-video-wrapper object, | |
.fluid-width-video-wrapper embed { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fluid Video Wrapper
Make videos fluid and keep video proportion
Markup
Padding top style attribute is calculated.
Style