-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat(docs): add description for an iframe aspect ratio fix #263
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for documenting this 🙏
docs/embed.md
Outdated
|
||
## Fix asset scaling in an iframe | ||
|
||
|
||
In some cases, scaling can work not as expected due to different asset aspect ratios, which means that your embed might look a bit small. | ||
This can be solved by maintaining aspect ratios. | ||
|
||
|
||
#### Example of an aspect ratio fix | ||
|
||
|
||
```html | ||
<div style="position: relative; padding-top: 75%; min-width: 400px;"> | ||
<iframe | ||
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" | ||
src="https://app.goabstract.com/embed/c53e8159-2e24-4118-b02b-6fe4b3a3afee" | ||
frameborder="0" | ||
allowfullscreen | ||
> | ||
</iframe> | ||
</div> | ||
``` | ||
Embed should have a wrapper, full width and height, so it would inherit the container size. | ||
In this case, `padding-top` is responsible for an aspect ratio, and to get a value you have to divide height on the width and multiply by 100 (`height / width * 100`), which means that `3 / 4 * 100 = 75` - is our `padding-top` value. | ||
|
||
|
||
More details can also be found [here](https://jameshfisher.com/2017/08/30/how-do-i-make-a-full-width-iframe/). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there is trailing whitespace before each line. Can you clean up the whitespace and HTML indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for noticing @amccloud!
docs/embed.md
Outdated
|
||
|
||
In some cases, scaling can work not as expected due to different asset aspect ratios, which means that your embed might look a bit small. | ||
This can be solved by maintaining aspect ratios. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is less of a fix and more of a fluid embed tutorial. Most 3rd party embeds work this way by default and require a wrapper element to maintain aspect ratio
Suggestion for title
# Create responsive embed to maintain aspect ratio
Co-Authored-By: Andrew McCloud <[email protected]>
…bstract-sdk into feat/docs-iframe-scale-note
No description provided.