Responsive YouTube videos

This commit is contained in:
Oliver Davies 2016-04-17 18:01:12 +01:00
parent 54ddebbe81
commit 346e11b486
2 changed files with 16 additions and 1 deletions

View file

@ -9,3 +9,16 @@ main
img
@extend .img-responsive
.embed-container
padding: 56.25% 0 0
position: relative
width: 100%
iframe,
embed
height: 100%
left: 0
position: absolute
top: 0
width: 100%

View file

@ -30,7 +30,9 @@ class YouTubeExtension extends Twig_Extension
public function embedCode($videoId)
{
return sprintf(
'<iframe width="560" height="315" src="https://www.youtube.com/embed/%s" frameborder="0" allowfullscreen></iframe>',
'<div class="embed-container">
<iframe src="https://www.youtube.com/embed/%s" frameborder="0" allowfullscreen></iframe>
</div>',
$videoId
);
}