Menu
Carl Camera

Anchor Border Anomaly

So I'm uploading my IE6 mouseover report to my blog and I notice this:

closeup of border width problem

The bottom borders of every one of my blog entry titles is shorter than it should be. And I only see this in IE.

So my reward for finding one bug is to find another. Well today I had a chance to pare down the XHTML to a bare bones example page that I submited to Quirksmode.

The problem is not limited to A(nchor) elements inside H2 elements inside DIV elements. It occurs for any A element inside a block element that inherits a non-zero letter-spacing value and appears immediately after a top-borderless DIV element.

Let me try that again: the DIV must contain a block element (H2, H3, P) that contains an anchor (A) element. The problem appears

  1. When the block element is the first element inside the DIV
  2. The DIV must have a border but not have a top border (any combination of left, right, and bottom)
  3. The block element must have a non-zero letter spacing value (negative or positive)

and it is most prominent when the font family is a monospaced font, though this is not a factor in recreating the rendering anomaly.

Granted, this is a rare case and planets need to align. Several ways for this NOT to happen

  1. remove the DIV
  2. remove the DIV border
  3. give the DIV a top border
  4. remove line-spacing property or set it to zero
  5. put anything between the DIV and the H2/block element
  6. move the letter-spacing property to the A element rather than the H2 element.

Comments

Glad you're running into these and fixing them so I don't have to! :)

IamWallaman 10 Oct 2005

Thanks! I'd rather not find them of course, but I may gain some net-fame since both have been accepted by Quirksmode as bug reports. This weird one with the border shrinking will run this Friday.

Chris Wilson of the IE Team stated somewhere that he monitors Quirksmode so I'm hoping these get fixed in IE7. Chris, if you're out there, It would be great if you could confirm that they'll be fixed.

Carl Camera 10 Oct 2005