graphicpush

Thoughts on branding, design, writing and life by Kevin Potts. Established 2003.

Star HTML Hack is Fading From the Horizon

The “star html hack” for IE will be gone from IE7. With all the other bugs the development team is squashing, hopefully it will not be missed.

There has been a lot of buzz about the upcoming IE 7 for Windows Vista. I have been following the announcements and commentary since the beginning, but have refrained from commenting thus far because A) I am not well-learned in some of the more arcane CSS 2.1 language and B) some of the other stuff in IE is just above my head so my eyes get kind of glazed over when I read about security and user agents.

But I do follow the IE Blog closely, and read September 2's post with some interest -- Improving the CSS 2.1 strict parser for IE 7. This lengthy post details the removal of the famous "star html hack" which has long been a favorite weapon in a CSS developer's arsenal. Essentially, it works like this:

* html #redbox { background: red; }

The element with the id of "redbox" will have a red background, _but only in IE_. I often use this rule in conjunction with the child selector, whose CSS rules are applied to every browser except IE. For instance:

html>body #redbox { background: red; }

My favorite use of this pair of hacks was to serve up 24-bit PNGs to good browsers and transparent GIFs to Internet Explorer. Its not a beautiful technique (requiring two images, after all), but it works well and serves users of alternative browsers a better visual experience. Example:

* html #tab { background-image: url(/images/tab.gif); }
html>body #tab { background-image: url(/images/tab.png); }

This being said, I am happy to see the IE development team finally fixing this bug in conjunction with many other problems, including the support of transparent PNGs. Hopefully IE7 will render CSS well enough that these hacks, along with all the other filters, will become obsolete when developing for future Explorer versions.

commentary + criticism

Veracon

wrote the following on Thursday October 20, 2005

Actually, to me this has been obvious for a long time: It’s just a fix in standards.

Isn’t it sort of obvious that the ‘html’ element doesn’t have a parent?