-
Notifications
You must be signed in to change notification settings - Fork 38
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 line height spacing for multiline code elements #162
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.
Needs a CHANGELOG entry
@@ -141,6 +141,8 @@ | |||
font-family: monaco, Consolas, "Lucida Console", monospace; | |||
font-size: 15px; | |||
font-size: 0.9375rem; | |||
// Match the line-height outside of tables | |||
line-height: 1.4; |
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 wonder if the keyword normal
would work, but happy with this if not.
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 and it would work for all the monospaced fonts we specify if we didn't have the padding on the top and bottom of the line. With that, normal
still causes some vertical overlap, though it depends on which browser how much.
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.
What impact does this have to code elements within paragraphs?
I wonder if this is related: #131 |
I'm still wondering if the reason this has broken is because the relative font units is not working in that area for some reason 🤔 The text looks a lot bigger than the surrounding regular text. |
Would you mind adding an example to: http://127.0.0.1:4567/code.html#code-examples please? |
On smaller screens, the I did some testing on the differences in vertical size between the monospace font-families and New Transport. I measured the height from the ascender to the descender on various combinations, all at 16px, and found:
All was on Firefox on OSX. |
I'll try and review this when I get some free time, please ping me if I don't. |
Will do 👍 |
@@ -2,6 +2,13 @@ | |||
|
|||
## Unreleased | |||
|
|||
## 2.0.10 |
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 needs rebasing and adding to the 'fixes' section of the unreleased stuff
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.
Happy to do this for you if you want
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.
Tom said he was happy for me to get this sorted
Text in our `<code>` elements is larger than the default Transport font on OSX, due to it using the Monaco font. This creates a taller formatting box for each line of text it has. We set a smaller font-size, and line-height in `<td>`s. This works for Transport but text in `<code>` sections appears squashed vertically. This sets the line-height for `<code>` to match that of content outside tables, to stop it squashing up. This has been tested with Consolas (the font Windows uses for `<code>`) and all other fallbacks.
ea6b425
to
31f551f
Compare
Text in our
<code>
elements is larger than the default Transport font on OSX, due to it using the Monaco font. This creates a taller formatting box for each line of text it has.We set a smaller font-size, and line-height in
<td>
s. This works for Transport but text in<code>
sections appears squashed vertically.This sets the line-height for
<code>
to match that of content outside tables, to stop itsquashing up.
This has been tested with Consolas (the font Windows uses for
<code>
) and all otherfallbacks.
Here's an idea of the changes this introduces, viewed on OSX Firefox.
Before
After