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

Iframe code width and height #479

Open
wyllyjon opened this issue Feb 25, 2022 · 2 comments
Open

Iframe code width and height #479

wyllyjon opened this issue Feb 25, 2022 · 2 comments

Comments

@wyllyjon
Copy link

Hello,

I allow users to import some videos in their profile, and it can be done from various sources (Vimeo, dailymotion, Youtube, etc.)
But the sizes of the iframe got from $info->code->html are not the same acording to the source.

Is there a way (except javascript) to set the width and height in the code with your library ?

Thanks for the help !

@oscarotero
Copy link
Owner

The best way to set a width & height to iframes is with CSS.
Websites don't always return width and height values or they don't match with the values in the html code. Sometimes is more useful the aspect-ratio value, because it allows to set any size to the iframe keeping the same proportions.

@oscarotero
Copy link
Owner

You can use the aspect-ratio css property for that https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio
Or if you need compatibility with old browsers the padding trick: https://nikitahl.com/css-aspect-ratio

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