The Trouble with Pixels
September 12th, 2006The trouble with pixels has been discussed earlier in this book and chapter and mainly comes down to this: In IE/Windows, users cannot resize text set in pixels. If you’ve used 9px type for your site’s body text, many visitors will click their browser’s Back button faster than you can say squint.
Even 11px type might be too small for some, depending on the font chosen (11px Verdana and Georgia get fewer complaints than 11px Times, for instance), the monitor size and resolution, the visitor’s eyesight, the degree of foreground/background contrast, and the presence or absence of distracting backgrounds. To a person who has less than 20/20 vision, the problem might be annoying. To one who is seriously visually impaired, it might be far worse than that.
There is also the occasional CAD engineer who likes to surf the web on his 4000 x 3000 32″ workstation monitor and pepper web design mailing lists with angry letters about flyspeck-sized text. If he actually wished to solve his problem, he could use a browser that supported Text Zoom or Page Zoom. If he preferred to use IE/Windows, he could switch on its option to ignore font sizes. He could even write a user style sheet like this one: html, body {font-size: 1em !important;}
But he would rather complain about his problem than solve it in any of these ways, because for him this whole thing is a religious issue. (He also complains that the magazines he subscribes to are filled with inane coverage of celebrities and their marital problems. And he dislikes peanuts, yet he keeps eating them.) As a designer, you are responsible for your users’ problemseven this guy’s.
The Font-Size Keyword Method
Little known and scarcely ever used, CSS1 (and later, CSS2) offered seven font-size keywords intended to control text sizes without the absolutism of pixels or the inheritance, cross-platform, and user option hazards of ems and percentages. The seven keywords appear next, and their meaning will be obvious to anyone who has ever bought a T-shirt :
xx-small
x-small
small
medium
large
x-large
xx-large
Why Keywords May Beat Them and the Percentages
As mentioned earlier, when you use ems or percentages, there is always the danger that their values will multiply, resulting in text that is too small or too large. By contrast, keyword values do not compound even when the elements nest.
If is small, is small, and is small, and p lives inside div, which lives inside body, the three small values do not compound (as ems and percentages do), and the result is still legible. Moreover, the result is still small (not x-small or xx-small). Ems and percentages compound. Keyword values do not compound.
Like ems, keywords are based on the user’s default font size. Unlike ems, keywords never descend below the threshold of adequate resolution. If the user’s default size happened to be 10px (unlikely, but possible), x-small would be 9px and xx-small would also be 9px. Obviously, in such a case, you would lose the size difference between x-small and xx-small. But you wouldn’t lose your readers.
Sounds perfect, doesn’t it? We get to specify sizes without smacking up against IE/Windows’ inability to resize pixels, and also without inflicting illegibly teeny type on any visitor. Font-size keywords seem to balance accessibility with the designer’s need for control. So what could go wrong? One word: browsers.