Iframe is not the correct size

hey everyone!

I can’t get my iframe that I’m trying to embed in a topic correct. look how small it is! does anyone know how to fix this?

thanks in advance!

1 Like

You need to set the iframe’s width and height as absolute values. Also, the width and height need to be set as attributes of the iframe, and not in a style attribute (Discourse will remove the style attribute when it processes the post.)

Here’s an example copied from a Youtube iframe that shows how it’s done:

<iframe width="560" height="315" src="https://www.youtube.com/embed/r-i6XpcL1Fs" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

I think the max width you can use in a Discourse post is 600. It should be fine to use the iframe code from your screenshot, but just add width="600" height="400" to it, after the opening iframe tag. You can try different values for the width and height to see what works.


@simon thank you so much! that worked perfectly! happy holidays!


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.