Skip to content

v4: Remove root font-size - #21524

Merged
mdo merged 3 commits into
v4-devfrom
v4-font-size
Jan 4, 2017
Merged

mdo merged 3 commits into
v4-devfrom
v4-font-size

Conversation

@mdo

@mdo mdo commented Jan 3, 2017

Copy link
Copy Markdown
Member

Fixes #19460.

This removes our fixed 16px font-size variable and it's usage throughout the project, allowing web visitors to utilize their customized browser default font-size. Visually, there is no difference between this change and what's been in v4 since we started it. The browser default is usually 16px, so you should be good to go there. In other places, and in case of customize root font-size, your content should scale nicely given the use of rems for type scale.

/cc @keithjgrant @patrickhlauke

@mdo mdo added accessibility Keyboard, screen readers, contrast, ARIA css Sass sources or compiled CSS v4 v4, the frozen docs on gh-pages labels Jan 3, 2017
@mdo mdo added this to the v4.0.0-alpha.6 milestone Jan 3, 2017
@patrickhlauke

Copy link
Copy Markdown
Member

LGTM

@mdo
mdo merged commit 0ffd369 into v4-dev Jan 4, 2017
@mdo
mdo deleted the v4-font-size branch January 4, 2017 03:33
@mdo mdo mentioned this pull request Jan 4, 2017
@Haroenv

Haroenv commented Jan 4, 2017

Copy link
Copy Markdown

Yay ❤️

@gthomas-appfolio

Copy link
Copy Markdown

We have been using $font-size-root variable in custom.scss to set to a value to match our legacy styles (13px) in our custom bootstrap build/theme.

What is the correct way to set this in our case?

@bardiharborow

Copy link
Copy Markdown
Contributor

@gthomas-appfolio 13 divided by 16 is 0.8125, so $font-size-base: 0.8125rem; should be appropriate.

@gthomas-appfolio

gthomas-appfolio commented Jan 5, 2017 •

Copy link
Copy Markdown

Thanks, wasn't quite sure if that was the 'proper' variable for this, thanks!

Edit: Using $font-size-base: 0.8125rem; does not appear to work the same (trying to decrease the size of all fonts throughout Bootstrap) - this PR removing this from _reboot.scss seems to disable scaling:

html {
 -  // Sets a specific default `font-size` for user with `rem` type scales.
 -  font-size: $font-size-root;

If so, would the proper way to customize this now be adding these lines to _custom.scss?:

html {
   font-size: 13px;
}

(BTW I'm not disagreeing with the spirit of this change, the reality in my case is I need to match some existing, non-Bootstrap styles)

@bardiharborow

bardiharborow commented Jan 5, 2017 •

Copy link
Copy Markdown
Contributor

@gthomas-appfolio ah sorry, I didn't process that we had dropped the html { font-size: $font-size-root; } declaration. You are correct that html { font-size: 13px; } should will set 1rem to equal 13px, and Bootstrap should adjust all it's components to suit. You should not need to recompile our CSS for this to work, unless of course you wish to make other changes.

@gthomas-appfolio

Copy link
Copy Markdown

No problem. Yes, I'm theming it quite a bit via _custom.scss, I'll try the approach I mentioned above, thanks again for the info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Keyboard, screen readers, contrast, ARIA css Sass sources or compiled CSS v4 v4, the frozen docs on gh-pages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants