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

feat(docs): add description for an iframe aspect ratio fix #263

Merged
merged 5 commits into from
Apr 29, 2020

Conversation

berezovskyicom
Copy link
Contributor

No description provided.

@berezovskyicom berezovskyicom linked an issue Apr 28, 2020 that may be closed by this pull request
@berezovskyicom berezovskyicom self-assigned this Apr 28, 2020
@berezovskyicom berezovskyicom changed the title feat(docs): add fix description for an iframe aspect ratio feat(docs): add description for an iframe aspect ratio fix Apr 28, 2020
Copy link
Contributor

@amccloud amccloud left a 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
Comment on lines 81 to 108

## 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/).

Copy link
Contributor

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

Copy link
Contributor Author

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.
Copy link
Contributor

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

docs/embed.md Outdated Show resolved Hide resolved
Vladimir Berezovsky and others added 3 commits April 29, 2020 14:16
@berezovskyicom berezovskyicom merged commit 9f19c3f into master Apr 29, 2020
@berezovskyicom berezovskyicom deleted the feat/docs-iframe-scale-note branch April 29, 2020 15:51
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

Successfully merging this pull request may close these issues.

Improve asset scaling in iframe when embedding a design
2 participants