A comment triggers image display in IE6

Ok, guys, let’s face this odd, very odd, behavior in IE6

These two pages are identical, except for the <title> (not relevant) and an empty comment on line 15 (present in the OK page, not present in the KO page)

http://ivanhalen.com/framework/ok.php
http://ivanhalen.com/framework/ko.php

Well, the page without comment (ko.php) is missing two “rounded corners” background images in the .header section (“Test > Login” part)
Instead, the comment in the ok.php page triggers the images display

This is just one thing that could really drive mad everyone: please, do you know what kind of problem is it and if there’s a solution? (apart from keeping the comment there…)

Ahhhhh, the HasLayout!! I have always to remember that strange IE6 behaviors are sons of HasLayout!! The comment took me out of the way, maybe I’d notice that before…
Anyway, Paul, I’m always wondered by your kindness and clarity of explanation: thanks for the Nth time you save my day! :slight_smile:

Hi,

It’s caused by the lack of layout on certain elements.


.box,.content{zoom:1.0}

That should fix it.

Whenever you have a container holding more than simple text then you should ensure that the element is in haslayout mode or all bets are off. Adding the html comments just triggered a different rendering algorithm and the content re-appeared but just as easily could have broke something else.

That’s the feature of haslayaout and its results are many and varied and the reason for years that many different bugs were documented but were all actually all from the same cause.

That isn’t odd behaviour from IE6 at all. It is a simple fact that IE6 can do all sorts of screwy things if you have comments in the wrong place.

http://www.positioniseverything.net/explorer/dup-characters.html has a good description of some of the things misplaced comments can do in IE6 and how to fix them. Thee main way to fix it is with a -3px right margin.

Sorry, Stephen, I read the article but still don’t know how it can be useful in my case…

Did I misplaced the comment? It seems to be placed right, but maybe I’m missing something… Even if the comment is not empty, the bug is still there

More, in my case the comment fix the bug, not triggers (the opposite of the article), allowing images to appear as in every other browser

Any other idea, please?