-
Posted in : Photographer
-
Hi,
When I embed Youtube videos into the portfolio pages, the height and width settings of the code are ignored and it comes up with full width.
Please take a look at this page:
https://andraslens.com/portfolio/videography/
And this is the source:
( I have removed the < and > signs in case it would cause a problem while posting )
iframe src=”https://www.youtube.com/embed/dCxCKMfRUY4″ width=”560″ height=”315″ frameborder=”0″ allowfullscreen=”allowfullscreen”></iframe
As you can see, the 560×315 is disregarded. I have tried the [embed] function and the WP’s built-in Youtube embedding as well. The result is always the same, the template seems to overwrite the size and makes it full-width.
Could you please tell me what I can do to have the portfolio pages display embedded videos in the actual size set in the codes?
Thanks in advance!
Hi @Dundy
You can try to use these custom css codes.fluid-width-video-wrapper iframe { width: auto; height: auto; } .fluid-width-video-wrapper { padding-top: 13% !important; }Thanks
Hi @serkan,
Thank you. Adding those lines kept the videos at full-width and reduced the height only:
I tried replacing “auto” with actual width and height but doesn’t affect it.
When I actually refresh my browser, I can see that first the frames load in the desired size set by the iframe parameters and then next second it goes full width.
Thank you for the support.
Hi,
You can change the custom css codes like these;.fluid-width-video-wrapper { max-width: 768px; } .fluid-width-video-wrapper { padding-top: 26% !important; }Thanks
Great, thanks. It displays fine on desktop but on mobile, the height is not proportionate:
I am using this code:
iframe src=”https://www.youtube.com/embed/dCxCKMfRUY4″ width=”560″ height=”315″ frameborder=”0″ allowfullscreen=”allowfullscreen”></iframe
with this CSS:
.fluid-width-video-wrapper { max-width: 768px; }
.fluid-width-video-wrapper { padding-top: 26% !important; }Note, if I change the width in the iframe code to 768px it becomes full screen width again and the height goes back to 315 – similar to the screenshot I sent you previously:
Thank you very much for your help.
You must be logged in and have valid license to reply to this topic.