• Resolved Alessandro Di Ruscio

    (@thirdeyeblind82)


    Hello everyone,
    I have a problem embedding a YouTube video. In the final page it looks too short.
    This is the html code in the page:

    <iframe width=”525″ height=”295″>

    Is there a way to change it and having the same size YouTube has?

    Thanks
    Alessandro

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    525 by 295 is the correct ratio for a YouTube video. The problem here seems to be that Elementor is forcing the width of the video to 100% width, but not adjusting the height as well. So on your page, the width is bumped up to 721, but the height is not adjusted accordingly.

    The theme you’re using is Twenty Seventeen, but the available width seems to have been adjusted by Elementor? Not sure, might want to ask Elementor about it so that they can adjust the global $content_width correctly.

    Edit: Yes, okay, so it seems that Elementor sets the width of the main area to 1140px, and then the width of that column to 65% of that. That would be 741px. Then with a 10px gap on each side, that leaves the main column width at 721px. So if you adjust the theme (or Elementor) to have a $_GLOBALS['content_width'] = 721; then it should be at the right size for embeds.

    Basically, embeds work based on width of the area they are destined to be inserted in. So it’s critical that themes, or any plugins that adjust them, tell WordPress the correct width, so that it can ask YouTube (or any other embed provider) for the embed code that fits that width correctly. The content_width global value is how they do that.

Viewing 1 replies (of 1 total)
  • The topic ‘Youtube video 525×295’ is closed to new replies.