top | item 32973107

(no title)

FrontAid | 3 years ago

Au contraire. That is good question. Everything in the snippet except the font-size should also work with the body selector. The font-size is an exception here as it defines the root font size that the `rem` unit is based on. And that has to be defined on html.

https://css-tricks.com/html-vs-body-in-css/

discuss

order

samtheprogram|3 years ago

This, in combination with the author trying to limit the number of bytes (adding another selector would be unnecessary and add to the length), is why.

clairity|3 years ago

in my personal css framework, i only do fluid type on headers, not body text, as i found the effect to be too subtle to matter. but header text can be overwhelming on small devices without it.

then you can let the user (agent) set the default font size on root/html.