Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

hopefully not too dumb a question, but why put this on html instead of body?


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/


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.


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: