IE 6 pseudo elements bug

First reported by Herman Peet in Bradsoft's TopStyle newsgroups. Nick Bradbury posted about it in his blog.

Updates

3.6.2004

Problem

When the space is removed between the pseudo element and the first curly brace, the selector will not be applied. For example:

select:pseudo-element{ declaration }
                     ^ space removed

To prevent the problem, ensure a space is added:

select:pseudo-element { declaration }
                     ^ space preserved

Download example style sheet and example html file

Testing

I've tested this with the following browsers and so far, IE 6 is the only browser to exhibit the failure. Even IE 5.5 gets it right.

Changing DOCTYPEs seem to have no impact on the behavior.

There is one notable exception. A bare-bones HTML document without a DOCTYPE renders the pseudo elements correctly. (However other elements such as the width on the body fail. Quirks mode, I guess.)

Examples

View examples with various DOCTYPEs

Example 1 - :first-letter pseudo element

Broken Example

p.broken:first-letter{font-size: x-large; font-weight: bold;}

Working Example

p.working:first-letter {font-size: x-large; font-weight: bold;}

Example 2 - :first-line pseudo element

Broken Example

p.broken:first-line{font-size: x-large; font-weight: bold;}

Working Example

p.working:first-line {font-size: x-large; font-weight: bold;}

Comments

Send comments, questions, critiques, links, etc. to jack at mvps dot org and I'll post them here.

Valid XHTML 1.1