The popular fix for responsive video embeds does not work!
-
Hi,
I have found a heap of articles online claiming to fix the issue of non-responsive YouTube video embeds. Can anyone advise my on why the following snippets of code will not make a video scale down correctly on my site?
The HTML code on in my blog post:-
<div class=”video-container”>
<iframe src=”https://www.youtube.com/embed/………..” frameborder=”0″ width=”560″ height=”315″></iframe>
</div>The CSS code in my stylesheet:- (not sure exactly where in the stylesheet it should go, so I stuck in right at the bottom!)
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px; height: 0; overflow: hidden;
}.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}Some people say to remove the fixed dimensions from the iframe, but in most of the articles/posts online they tell you to copy and paste exactly as is!
Any advice much appreciated!
Thanks
- The topic ‘The popular fix for responsive video embeds does not work!’ is closed to new replies.