http://stilbuero.de Klaus Hartl – Stilbüro - Klaus Hartl


Jump to: Search, Additional Information.


IE’s universal selector is really universal

As it turned out, the universal selector is a little too universal in IE 7 (RC 1).

Some simple CSS like

body * {
    display: block;
    border: 1px solid;
    padding: .25em .5em;
    background: #808080;
}

with such HTML

<body>
    <p>
        ...
    </p>
    <!-- An HTML coment -->
    <p>
        ...
    </p>
</body>

results in 3 Boxes in IE 7.

Here’s my own test.

This opens the door for some new hacks and even an amazing technique to make the :before and :after pseudo-elements possible to some extend.

This technique would also make for a good clearing floats without presentational markup, as long as the clear property is applied (not tested).

Apart from that, this is not a minor issue. With such a parser bug the universal selector becomes useless or we the web developers are doomed to never use HTML comments again to be able to rely on this selector. I cannot believe that this “feature” will make it into the final release.

3 Comments

Comments feed

  1. This is happening in IE6 also.

    Version 6.0.2900 shows 3 boxes here on my work’s desktop.

    Comment by Luna, October 9th, 2006 at 11:04 am

  2. can someone post a screenshot?

    Comment by tester, October 19th, 2006 at 2:13 pm

  3. watches firefox to see just behavior

    Comment by Maurizio, March 4th, 2007 at 5:35 pm



Klaus Hartl – Stilbüro is powered by WordPress, jQuery, XHTML, CSS and me.