CSS font-weight, and how it’s lack of support.
Posted in Browsers, CSS on January 13th, 2009 by Tony – Be the first to commentRichard Rudder has written a great article on how Font-weight is still broken in all but one browser. It’s something that I myself have never really bothered with much, as it hasn’t seemed to work, and so I’ve stuck to the tried and true ‘font-weight: bold’ and ‘font-weight: normal’. If I wanted a heavier font, I specified a heavier font in the ‘font-family’, or ‘font’ declaration.
Since its inception in 1996, CSS has provided a way of displaying these other weights through use a numerical scale with the font-weight property. This is still almost entirely broken in every current browser except Firefox 3 on Mac.
Wow. It’s always been there.
As well as the normal and bold keywords, font-weight also takes nine numerical values of 100, 200, through to 900. These numbers span the scale from ultra-light to ultra-black, with normal defined as 400 and bold defined as 700. So to specify a ‘light’ weight you would write font-weight :300. Here’s a rough guide matching the numeric scale to common weight terms:
100 ultra-light, extra-light 200 light, thin 300 book 400 regular, normal 500 medium 600 semibold, demibold 700 bold 800 heavy, black, extra-bold 900 ultra-black, extra-black, fat
It’s a great article, with great examples. And it’s a crying shame this doesn’t work in more browsers. There are workarounds he talks about, but just don’t seem worth it. Thankfully Webkit seems to be working on this issue.
Frankly it’s really depressing that this bug is still present after 12 years, and regardless of success or otherwise in Acid tests, these browsers cannot truly say they support even CSS 1 fully or correctly. I hope we see fixes soon (apparantly already done in WebKit). I know fonts are a tricky subject in operating systems, but if it can be done in Firefox 3/Mac then surely other browsers can quickly follow.