-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix scrolling of code examples #717
Conversation
Alternative idea: calculate height using something like |
Ugh. @thetrall As much as I'd prefer not to have to calculate margins, I agree that that's probably the right thing to do here. Either that, or cancel out the margins on the rendered HTML? 😬 |
@shawnbot Do you have any issues with just setting |
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.
I tested this on the branch deployment and it looks great. Ship it! 🚀
This fixes #708 where some code examples in the docs show a scrollbar.
The problem seems to be that if a code example uses margin, it doesn't get included when calculating the height for the
<iframe>
. For example the.tabnav
has a height of37px
with a bottom-margin of15px
, but the height of the<iframe>
is only37px
, causing the rest to scroll.Adding
overflow: auto
to a parent element of the code example seems to fix it.✨ Preview ✨
Alternatives
We could add any other property that creates a new block formatting context. Not sure if
overflow: auto
has side effects? 🤔display: flow-root
would be most appropriate, but browser support isn't that great yet.