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

v4: respect browser font size setting #19867

Closed
timseverien opened this issue May 9, 2016 · 2 comments
Closed

v4: respect browser font size setting #19867

timseverien opened this issue May 9, 2016 · 2 comments
Labels

Comments

@timseverien
Copy link

timseverien commented May 9, 2016

I recently wrote an article arguing why pixel units on font-size is generally a bad idea: http://www.sitepoint.com/stop-maiming-bodies-the-perils-of-pixel-font-size/

TL;DR: Many major browsers have a setting that allows users to adjust their font size, which is a great accessibility feature. This setting sets a base font size. By using absolute units, that setting is completely ignored for those elements and descendants.

Font size setting in Google Chrome

Examples:

/* All body content will be 14px, regardless of the browser setting */
body { font-size: 14px; }
/* All body content font-size will be based on the browser setting */
body { font-size: 100%; }

/* The contents of h1 and all it’s children will be based on 36px, regardless of the browser setting */
h1, .h1 { font-size: 36px; }

In order to provide proper accessibility, developers who use Bootstrap are required to:

  1. Have knowledge of this browser setting, understand it’s value and know how to respect it
  2. Use Sass
  3. Review and overwrite all font-size variables

Solution:

Use relative units, always.

html { font-size: .625em; }
body { font-size: 1.4rem; }

h1, .h1 { font-size: 3.6rem; }
@RyanZim
Copy link

RyanZim commented May 9, 2016

Duplicate of #19460, please close this issue. Thanks!

@timseverien
Copy link
Author

Ah. I did look but couldn’t find a similar issue. Sorry!

@twbs twbs locked and limited conversation to collaborators May 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants