From 346e11b486da19a26ae0ae1b7dda649c71061eb6 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 17 Apr 2016 18:01:12 +0100 Subject: [PATCH] Responsive YouTube videos --- assets/sass/_base.sass | 13 +++++++++++++ src/AppBundle/Twig/YouTubeExtension.php | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/assets/sass/_base.sass b/assets/sass/_base.sass index 121630e1..e4cb3ad9 100644 --- a/assets/sass/_base.sass +++ b/assets/sass/_base.sass @@ -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% diff --git a/src/AppBundle/Twig/YouTubeExtension.php b/src/AppBundle/Twig/YouTubeExtension.php index 577aedeb..f55e615d 100644 --- a/src/AppBundle/Twig/YouTubeExtension.php +++ b/src/AppBundle/Twig/YouTubeExtension.php @@ -30,7 +30,9 @@ class YouTubeExtension extends Twig_Extension public function embedCode($videoId) { return sprintf( - '', + '
+ +
', $videoId ); }