Wolf’s Little Store

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 body can 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 unitless line-height which is puzzling. Generally you want 1em to get propagated down the document tree rather than simply the computed value of 1. 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.

One response

Leave a Reply

Write in English, stay on-topic and polite.