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

Convert to rems during render #90

Open
siddharthkp opened this issue May 16, 2020 · 5 comments
Open

Convert to rems during render #90

siddharthkp opened this issue May 16, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@siddharthkp
Copy link
Owner

Authoring styles on a scale removes the need to think in units, but we should recommend folks to define their themes with rems instead of px (including the default themes) so that we make sure the result is accessible :)

@siddharthkp siddharthkp added the enhancement New feature or request label May 16, 2020
@ankibalyan
Copy link
Contributor

we can do it by converting our base font to 10px and with that calculation will also become easier for rem units.
We can set body size as 10px in % so that it respects browser's zoom-in zoom-out functionality. to do so.

body {
  fontSize: 62.5%; // 10/16 = 0.625
}

so this will be conversion afterwards.

5px = 0.5rem
10px = 1rem
25px = 2.5rem

reference: https://developer.mozilla.org/en-US/docs/Web/CSS/font-size

@ankibalyan
Copy link
Contributor

Open for discussion, let me know if you've something else in mind.

@ankibalyan
Copy link
Contributor

Another reference from Material-UI, they suggest this change from theme creation utility function.
https://material-ui.com/customization/typography/#html-font-size

@oliviertassinari
Copy link

@ankibalyan you can look at the history of this MUI markdown, I think that we link an older article about the topic, maybe from 2011.

@ankibalyan
Copy link
Contributor

ankibalyan commented May 22, 2020

@oliviertassinari sorry, I did't see any old article. can you please link it.
I just checked this one, and here is the diff that you've committed link mui/material-ui@d798533

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants