Skip to content

Instantly share code, notes, and snippets.

@rjpeter2
Created February 8, 2013 15:38
Show Gist options
  • Save rjpeter2/4739764 to your computer and use it in GitHub Desktop.
Save rjpeter2/4739764 to your computer and use it in GitHub Desktop.
SASS for Responsive Youtube Video
.parent-of-iframe {
float: left;
clear: left;
position: relative;
margin: 1.5em 0;
padding-bottom: 56.25%; /* 16/9 ratio */
padding-top: 30px; /* IE6 workaround */
width: 100%;
height: 0;
overflow: hidden;
a {
display: none;
}
iframe,
object,
embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
@media all and (min-width: 480px) {
.parent-of-iframe {
width: 45%;
margin-bottom: -25%;
iframe,
object,
embed {
height: 56.25%;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment