Mac IE5 Hack

This paragraph should be highlighted green in IE5/Mac, red otherwise

The css that does it:

.hacked {
	background-color: #060;
/* test \ this commented backslash character between rules appears to have the
effect that macIE5 ignores the following rule.  Odd, but extremely useful. 
*/ .hacked { background-color: #C00; }
.hacked { color: #fff; }

First identified and published by Sam-i-am, this hack hides styles from IE5/Mac and IE5.1/Mac, but not IE4.5 or IE4.01 for Mac, nor does it hide styles from iCab, Netscape 4-6, Opera/Mac.

This parsing bug in IE5.x/Mac operates regardless of whether HTML or XHTML is used, a DOCTYPE is supplied or whether there is white space between the comment and the rule. The backslash can appear anywhere in the comment.

Back to MacEdition Guide to CSS Bugs in IE5/Mac