Recipe 9.5 Keeping CSS Rules from Internet Explorer 5 for Macintosh

‚  < ‚  Day Day Up ‚  > ‚  

Problem

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

Solution

To hide CSS rules from Internet Explorer 5 for Macintosh, insert a backslash in front of the closing comment with the characters */ :

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

After the rules pertaining to Internet Explorer 5 for Macintosh, insert another comment line:

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

Discussion

This method exploits a simple comment-parsing problem found in Internet Explorer 5 for Macintosh. The backslash before the closing comment causes the browser to think the comment actually has not closed; any valid CSS rules are hidden, allowing entire rule sets to be hidden from the browser until the next closing comment marker is hidden.

See Also

The specification about adding comments in CSS at http://www.w3.org/TR/2004/CR-CSS21-20040225/syndata.html#comments.

‚  < ‚  Day Day Up ‚  > ‚  


CSS Cookbook
CSS Cookbook, 3rd Edition (Animal Guide)
ISBN: 059615593X
EAN: 2147483647
Year: 2004
Pages: 154

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net