RSS Article RSS

Pseudo-Class Workaround for IE6

I’ve been using this workaround to deal with IE6’s lack of pseudo-class support. If, for example, I wanted to float the first news list item right, then I would use:

#ie-root #news li { float: expression(this.previousSibling==null?'right':'none') }

Since I use a conditional that wraps the whole site in an extra div called “ie-root” if the browser is IE6, this rule targets that first list item IE6 only.

I know this trick has been out there for a while but I haven’t seen it in too many places–especially considering how powerful pseudo-classes can be.

Leave a Comment