-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
CSS in HTML template: adjust #TOC and h1 on mobile #7835
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 is the default for this - or does it vary with the browser?
Also what is the default for h2, h3, etc.?
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.
My specific worry is that if you set the h1 font-size to 1.8, it will be indistinguishable from h2. Maybe we should explicitly set all hN font sizes, using some kind of harmonious scheme?
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.
By the way, my own aesthetics prefer much smaller headings (more like what you get in print articles). However, then you have some difficulty distinguishing 5 or 6 heading levels. It can perhaps still be done by not using bold fonts for all of them.
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.
Different browsers used to have different values for this, but nowadays this is all standardized. I just tested Chrome, Firefox and Safari on macOS and all set the
h1
to2em
. With 1em being 16px in modern browsers, this would be 32px, but we define 1em on desktop-sized screens withhtml { font-size: 20px}
, so in this stylesheet it's 40px.yes, that's what people used to do (and had to do due to browser differences). My idea with this stylesheet was to rely on browser defaults as much as possible, to keep it small. And I think it worked out pretty well generally... except that the h1 is too big on mobile :P But arguably it's not too bad and we can also just leave it...
That would be bad indeed, but I tested it and it works out like this: We have:
so on mobile, 1em is actually
20px * 0.9 = 18px
. Thus:h2 is 1.5em (by browser default) -> 27px.
If we set h1 to 1.8em -> 32.4px.
(you can confirm these pixel values by looking at the "calculated" tab in the browser's dev tools when having an h1/h2 element selected)
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.
we already do that, because with browser defaults for some reason, h5 and h6 are smaller than 1em, so we set them to 1em.
h4, h5, h6 and paragraph text all are 20px, but:
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.
OK, this sounds reasonable then!
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.
great, I updated the tests...