Style base typography off of html instead of body#279
Conversation
|
I'm not sure I have a strong opinion, but this post has some good thoughts: https://css-tricks.com/html-vs-body-in-css/ Do we need to put PR looks good to me ⛴ |
|
Thanks for sharing that article, @smharley, I hadn’t seen that. I could be missing something, but I’m not finding many valuable insights from that article. Specifically, I was looking for drawbacks when styling directly off of
“…it would seem appropriate…” isn’t a convincing stance.
Without specific drawbacks, I think doing this so to not have another ruleset is fine. |
|
Yeah, I'm not sure there's a set rule or anything. It just sounded like the way we had it before was ideal, except for I don't think it matters, I'm just not used to putting a lot of styles on the 👍 |
Because `rem` units calculate their value off of the root element (`html`), setting our base font size on the `html` element instead of the `body` element means that we can adjust the global font size and all relative units will follow.
759f59e to
e354c0a
Compare
Because
remunits calculate their value off of the root element(
html), setting our base font size on thehtmlelement instead ofthe
bodyelement means that we can adjust the global font size and allrelative units will follow.
Here’s an example:
I have a component, sized in rems…
Currently, if I adjust Bitters’ base font size from
1emto2em, my expectation would be for the padding above to then equate to2em/32px. But since we are setting this base font size onbodyand nothtml, this isn’t true and that padding will still equal1em/16px.