September 1, 2009
MarkBernstein.org
 
Follow me on Twitter

A Design Blunder in CSS

I've been reading, and enjoying, Dan Cederholm’s Handcrafted CSS . But Cederholm — and everyone else — seem to me to be dancing around an unspoken but serious blunder in the way CSS is designed.

Perhaps the most natural way to choose the size of body type is to relate it to line length: a line should not be too long, or too short. If you’ve got plenty of space, you choose a larger typeface. If you’ve got to fit into a tight corner, you use smaller characters. Everyone knows this, but CSS won’t let you do it.

CSS lets you say, “This column runs half-way across the page”, and then adjusts the column size to the page size. But (as far as I can see) there’s no way to say, “I want to choose whatever text size gives me 45 ems per line.” And that’s the common case! Yes, you might also want a minimum-size (45 ems per line, but never smaller than 9pt) or even a maximum size. But most often, you want to specify font size in terms of line length, and this seems to be exactly what you cannot do.

Of secondary interest; nobody talks about this gap. Why not?