Skip to content

Instantly share code, notes, and snippets.

@designbuildtest
Created July 31, 2014 22:08
Show Gist options
  • Save designbuildtest/23be068d0c3cc5d467c0 to your computer and use it in GitHub Desktop.
Save designbuildtest/23be068d0c3cc5d467c0 to your computer and use it in GitHub Desktop.
Responsive video's
<?php
function mytheme_wrap_oembed_with_div( $html ) {
return '<div class="oembed-container">' . $html . '</div>';
}
add_filter( 'embed_oembed_html', 'mytheme_wrap_oembed_with_div', 10, 3);
add_filter( 'video_embed_html', 'mytheme_wrap_oembed_with_div' );
?>
.oembed-container {
display: block;
max-width: 100%;
margin-bottom: 0.75em;
}
.oembed-container embed,
.oembed-container iframe,
.oembed-container object,
.oembed-container video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.oembed-container {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment