Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iframes do not display properly in theme (dimensions) #5

Closed
vgoel opened this issue May 4, 2019 · 2 comments
Closed

iframes do not display properly in theme (dimensions) #5

vgoel opened this issue May 4, 2019 · 2 comments

Comments

@vgoel
Copy link

vgoel commented May 4, 2019

I am trying to embed Youtube videos in a blog post ... please see snippet below. The dimensions of the embedded video that show up in the post are not what are specified in the code.

<iframe width="560" height="1200" src="https://www.youtube.com/embed/v5ASgX60Lg8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

@chrisrhymes
Copy link
Owner

It looks like the best way of accomplishing this with Bulma is to wrap the iframe in a figure tag with the .image class and the ratio you want to use, such as .is-9by16 and then apply the .has-ratio class to the iframe and remove width and height. This way, the video will be responsive and still stick to the desired ratio on different screen sizes.

<figure class="image is-9by16">
<iframe class="has-ratio" src="https://www.youtube.com/embed/v5ASgX60Lg8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</figure>

The full list of available ratio's is available on the Bulma website

I've found markdown can be picky with the indentation of html tags and sometimes converts to <pre> tags, so I try not to indent the html where possible.

@vgoel
Copy link
Author

vgoel commented May 4, 2019

Works good now. Thanks

@vgoel vgoel closed this as completed May 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants