Font sizing with rem - Snook.ca - 0 views
-
The problem with em-based font sizing is that the font size compounds. A list within a list isn't 14px, it's 20px. Go another level deeper and it's 27px!
-
The rem unit is relative to the root—or the html—element. That means that we can define a single font size on the html element and define all rem units to be a percentage of that. html { font-size: 62.5%; } body { font-size: 1.4rem; } /* =14px */ h1 { font-size: 2.4rem; } /* =24px */
-
I'm defining a base font-size of 62.5% to have the convenience of sizing rems in a way that is similar to using px.
- ...3 more annotations...