Initial Problems with Keyword Implementations
2006
The seven font-size keywords might have been implemented correctly and uniformly, but they were not. Unfortunately, the keywords were ineptly or incorrectly implemented in the first browsers that attempted to support them, although in one case they were correctly implemented with results so bad they actually caused a subsequent version of the CSS standard to change.
(Netscape 4.5 rendered xx-small at six pixels three pixels below the threshold of legibility because Netscape’s engineers were following the W3C’s initial recommendation that each size be 1.5 times larger than the size below it. The W3C changed its recommendation to a gentler scaling value of 1.2 after seeing what Netscape had done.)
The Keyword Flub in IE/Windows.
Meanwhile, IE4/Windows, IE5/Windows, and even IE5.5/Windows got keywords wrong in a different way. In these browsers, there is a logical disconnection between the keyword and the way it is rendered. Small is medium, medium is larger than normal, and so on. How the heck did something that weird happen?
The engineers who developed IE for Windows were trying to do the right thing. Remember the seven tags of Netscape, mentioned in the beginning of this chapter? The IE developers mapped the seven CSS keywords directly to the seven Netscape font sizes. In many ways, it was a logical thing to do. Let’s give the team some credit for trying to support keywords in a way that would make sense to designers who had cut their teeth on Netscape font-size hacks.
The problem, of course, is that the sizes do not map to the keywords. In old-school browsers, is the default or medium size that the user has specified in her preferences. In Netscape’s extended HTML markup, is assumed unless you specify another size. Logically, a default size should map to the medium CSS keyword. Unfortunately, in the original IE/Windows scheme, maps to small instead of medium because small is the third size up from the bottom of the list.
Progress Happens, but Usage Eludes
Eventually, IE5/Macintosh, Netscape 6+, Mozilla, and IE6 got font-size keywords right. But by the time that happened, millions were using IE5 and Netscape 4, which got keywords wrong. If designers used CSS keywords as intended, the display would be off in IE4-5/Windows (and, less importantly, it would also be off in Netscape 4). If designers deliberately misused keywords to make the display look right in IE4-5/Windows, the display would be off in all other browsers and in later versions of IE/Windows. What could designers do? What most of us did was consider CSS font-size keywords to be just another option that didn’t work.
The Keyword Comes of Age: The Fahrner Method
You can read the evolution and details of Todd’s method in A List Apart’s “Size Matters” .
It works like this:
• Because 4.0 browsers don’t understand @import, they ignore the imported style sheet containing CSS rules they would only bungle. Let 4.0 browser users see text in the size they choose as their default, or if necessary, serve them pixel values in a linked external style sheet.
• Use the Box Model Hack to serve false font-size keyword values to IE5.x/Windows and correct values to more compliant browsers, just as we used it to serve false and true margin, padding, and content-area values to differently enabled browsers.
• Add a CSS rule with greater specificity to protect Opera from one of its bugs. (See the “Be Kind to Opera” rule in a discussion of the Box Model Hack.)