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

Look up / figure out today's best practice in setting font-size #10

Closed
jensimmons opened this issue Feb 4, 2019 · 3 comments
Closed

Comments

@jensimmons
Copy link
Owner

For years, we've been doing this:

html {
  font-size: 100%;`
}

as the best practice. That starts out most users with a default font size of 16px. But leaves the typography size easily changed with zooming.

What's today's best practice? Do UA files set font-size in px? Do they already set it to 100%, making this line of code redundant?

What is best today?

Every once in a while, someone revisits this question and writes up a blog post. Where are we at on this now?

@jensimmons jensimmons added help wanted Extra attention is needed philosophical Further information is requested to do labels Feb 4, 2019
@olach
Copy link

olach commented Feb 4, 2019

I think this was needed back in the days when IE6 was the latest and greatest. This fix was needed to prevent text sizing issues in that browser. Read more in this article:
https://alistapart.com/article/howtosizetextincss#section5

Tim Brown (@tbrown) writes in his latest book Flexible Typesetting:

It may surprise you to learn that declaring this font size on the root element is unnecessary. Browsers do it for us by default. They use readers’ default font size as the root font size, even if we do nothing. And what we’re doing here is essentially nothing. We’re telling the browser, “Yes, good job, keep doing what you’re doing.”

@tigt
Copy link

tigt commented Feb 10, 2019

Nicolas Hoizey discovered a lot of browsers don't even set it at 16px by default:

Device / browser Default font size
Opera Mini 4.5 13px
Palm webOS 2.0 & webOS TouchPad 14px
Opera Mini 7 17px
AOL 9 20px
Cybook Odyssey (e-book reader) 21px
Blackberry 6.0 22px
NetFront NX 23px
Kindle 32 26px

Respecting the browser default is ideal, especially since setting html { font-size: <whatever> } doesn't influence how rem (or em) are resolved inside media queries, Safari’s weird behavior when forcing text to be at least as large as a user-configured minimum, etc.

@jensimmons
Copy link
Owner Author

I removed

html {
  font-size: 100%; /* Is this needed? Define the best way to define font size. */
}

We can add it back in if we discover a current reason for it.

@jensimmons jensimmons added typography and removed philosophical Further information is requested help wanted Extra attention is needed to do labels Feb 12, 2019
charakterziffer added a commit to charakterziffer/charakterziffer.github.io that referenced this issue Feb 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants