IE8 Bug – HTML Spacer Entities Create One Pixel Jog In Line-Height

by Richard Fink on June 23, 2009

I was putting together some demo pages a while back and I noticed that the line-height (or “leading” as it’s called in the print world) was ex­pand­ing slight­ly be­tween certain pairs of lines. This caught my eye because the line-​height was set explicitly to a px value in the CSS. The spac­ing between any two ad­ja­cent lines should have been totally uni­form but yet some were wid­er apart than oth­ers by one pixel.

Here’s a snippet using underlined text to illustrate:

IE8 Line-Height Bug Graphic

This was in IE8 on Windows XP. I checked FireFox, Safari, Chrome, Op­era, all looked fine. Even IE8 on Vista was fine.

I narrowed it down, finally, to the presence of HTML spacer entities like   or  . For some reason, spacer entities like these, for which there are no corresponding characters in the font, cause an extra pix­el of line-height to appear in IE8 on Windows XP.

After confirming the bug on three separate XP machines, I filed a for­mal bug report on the Microsoft Connect site:
1 Pixel Jog Caused By Insertion Of HTML Character Entities
And then, as an extra kick in the pants, I duplicated the same bug re­port on the IE newsgroup microsoft.​public.​internetexplorer.​gen­eral. This news­group isn’t restricted to bug reports, but it is mon­itored by look­outs from Microsoft who will pass along anything that looks to them like a sig­nificant problem.

If you feel strongly that you’ve spotted a browser bug that’s repro­duc­ible on computers other than your own and will therefore adversely ef­fect a lot of users, don’t feel bashful about making some noise. No one will blame you, and many might have you to thank.

I also supplied a test page that reproduces the problem. But re­mem­ber, you won’t actually see the 1px jog in line-height unless you’re one of the lucky tens of millions of people using IE8 on XP!

The bug has since been confirmed. Web developers might have to learn to live with it because it’s going to be difficult to patch. De­vel­op­ers have a very lim­it­ed choice of typographic tools to begin with and it’s a shame to have a prob­lem like this crop up. Especially dis­ap­point­ing in IE because that means the in­stalled base of users sus­cep­tible to the bug will be a­round for years and years. And this was a ver­sion that was in development for nearly a year.
I was a Beta tester for IE8. It’s upsetting to see this, really.

Using entities like   or   or   can be much more con­ven­ient than crafting an equivalent using CSS. But now it seems we have to ei­ther shy away from them or simply accept the side-effect. I still use XP on my main development machine and I do use spacer en­tities. It’s funny how, once you know something is there, you can’t help but notice it. Right now, since I know where the entities are, ev­ery time I check one of my posts in IE8, the extra line-height is the first thing that draws my attention.

Did you enjoy this article? Subscribe to Readable Web
and receive updates as new entries are added.

Related Articles:

  1. Apple And Microsoft’s ClearType Fonts: A Leading Typographer Asks A Question
  2. Mozilla Formally Announces Support For WOFF (Web Open Font Format)
  3. Web Fonts At TypeCon 2009
  4. Apple And Microsoft In Talks On Fonts, Part II
  5. An Interview With Kernest’s Garrick Van Buren

Sharing Options:

{ 8 comments… read them below or add one }

Joe Clark June 24, 2009 at 5:54 am

You mean you’re using “spacer entities” (fun neologism, BTW) just like spacer GIFs? Because they’re easier than CSS?

You’re so 2009 you’re 1997!

Richard Fink June 24, 2009 at 11:04 am

@Joe Clark: Sometimes, yes I do.
 For certain kinds of word-spacing and kerning problems where the CSS alternative is using a span element with a class attribute, I find inserting a spacer entity much less unwieldy.
 Plus, there are instances where the user has no access to the CSS in a page and wishes to format their text. For example, with indentation as I have done here in this reply to you.
I’ll be doing a post about all of the spacer entities — some of them really “spacer characters” — and authors can choose for themselves what makes sense.
Glad you found my neologism fun!

Zoffix Znet August 11, 2009 at 3:25 pm

First of all, I think this is a ridiculous post. 1px line height difference? No offence, but web design isn’t print design; if you want to control user experience to the pixel then you picked a wrong profession.

Second of all, I could not reproduce the bug when using text-decoration: underline overline; and line-height set in pixels (and it shouldn’t be set in them) to make those two lines touch each other. Perfect in IE8 on Windows.

Lastly, if you set line-height in `em` units, the line height vary by a pixel in Firefox and I’m sure in many other browsers.

Cheers!
Zoffix Znet

Richard Fink August 11, 2009 at 5:56 pm

@Zoffix Znet:
web design isn’t print design; if you want to control user experience to the pixel then you picked a wrong profession.
The human eye is capable of distinguishing approximately 600 points per inch.
Now, speaking not as a web designer, but as a “user” who is as self-interested in controlling my experience as you are, I would prefer it if web authors had control over all 600 of those points. If they did, I think my experience would improve substantially.
You may disagree – perhaps slovenliness and/or imprecision is a part of the web’s charm and we will all miss it greatly should authors be given, heaven forbid, such control.
Frankly, I’d be more worried about who has control over content, but hey, that’s just me being paranoid, probably. I’m crazy enough to think that Amazon has the power to delete the books it doesn’t want you to read right off your Kindle! Crazy, huh?
Thanks for your input.

Chetan Crasta September 21, 2009 at 6:57 am

Congrats on finding such a subtle bug!
Just one thing: line height and leading are not the same thing.
When you subtract the content box height from the line height you get the leading.

Richard Fink September 21, 2009 at 7:29 am

Chetan,

I was reading your observations about font rendering, as well. I’ll be going back to take a closer look. Good stuff. Bookmarked!
Yes, you’re correct. The CSS term ‘line height’ doesn’t map exactly to ‘leading’ in the print world. thanks for bringing up the distinction because I was planning, at some point, to write a glossary of print-to-web terms.
Regards, Rich

Barry October 22, 2009 at 1:59 pm

I’m also very frustrated by this bug, running windows server 2003 IE8 tried & tested everything. I’m sorry to say it looks better in IE6… just hope this bug gets sorted.

And sorry Zoffix
“if you want to control user experience to the pixel then you picked a wrong profession.” lol…. funniest thing I’ve heard all week, you probably still use tables Zoffix with 4px borders.

17shadu November 5, 2009 at 1:59 am

Yes ,I have also experienced this problem, I see this site IE8’s CSS HACK.
position:relative; top/*\**/:1px\9; *top:0;

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post: