XML technologies / CSS / CSS Cookbook / Hacks, workarounds and troubleshooting / CSS rules hidden from Internet Explorer 5 for Macintosh

(Excerpt from “CSS Kochbuch” by Christopher Schmitt)

Problem

You want to hide certain CSS rules from Internet Explorer 5 for Macintosh.

Solution

You can hide certain CSS rules from Internet Explorer 5 for Macintosh by placing a backslash (\) before the closing comment delimiter:

/* \*/
h1 {
 font-size: 200%;
 text-transform: uppercase;
 background-color: #666;
}

After the rules to be hidden from Internet Explorer 5 for Macintosh, insert another comment line:

/* */
p {
 text-transform: uppercase;
}

Discussion

This method exploits a small problem in Internet Explorer 5 for Macintosh’s comment parser. The backslash before the closing comment delimiter makes the browser treat the comment as unfinished, so it ignores all rules until the next closing comment delimiter.

See also

The CSS 2.1 specification on comments in CSS.

  

 

 

 

back to top