August 18, 2008
Unitless line-heights
Jeremy Keith writes about Eric Meyer’s presentation on CSS frameworks at an Event Apart, SF:
Four of the nine frameworks are setting font sizes on the body with pixels. Tripoli uses Richard’s 62.5% rule. Eric points out how using a 76% rule on the
bodycan lead to inconsistent font-sizing between browsers because of the inconsistencies of rounding off font sizes. One of the frameworks, Content With Style, uses a unitlessline-heightwhich is puzzling. Generally you want1emto get propagated down the document tree rather than simply the computed value of1. You don’t want a 40 pixel element having a line height of 12 pixels.
This is incorrect: a 40 pixel element will have a line height of 40 pixels when your line height is set at 1. If you are using pixels for font sizes, unitless line heigths are best - with unitless line heights there’s never going to be negative leading due to CSS inheritance bugs. I mostly set a 1.4 line height at the body element.
A short google search on the subject led me to the coincidentally same-titled Unitless Line Heights by… Eric Meyer. The web design world is very small, or Meyer has strong Google Mojo.
I consistently size text with pixels. Text resizing is a browser feature, not a website feature.
Hey, just wanted to let you know Jeremy got the point I was making inverted, and that he’s edited the post to correct that.
Also, I have both strong Google Mojo and am one of the few people who’s written about this point in detail. So, yeah.
August 19th, 2008 at 2:58 ∞