Skip to content

Instantly share code, notes, and snippets.

@bjmiller121
Last active August 29, 2015 14:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjmiller121/2c9c674e20a9012f4fe8 to your computer and use it in GitHub Desktop.
Save bjmiller121/2c9c674e20a9012f4fe8 to your computer and use it in GitHub Desktop.
Proportionate iframe resize
/* Proportionately resize iframes. Add class to a wrapper around the iframe */
.iframe-4-3,
.iframe-16-9 {
position: relative;
padding-bottom: 75%; /* 4:3 */
height: 0;
}
.iframe-4-3 iframe,
.iframe-16-9 iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.iframe-16-9 {
padding-bottom: 56.25%; /* 16:9 */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment