Cross Browser Issues: CSS Hacks Explained, Tips, Tricks and Fixes - Hiding CSS from Buggy Browsers
(Page 3 of 5 )
It may be in your best interest for several reasons, to simply hide CSS files from certain browsers. One reason to do this would be that providing browser support for many browsers takes a lot of time, especially if you change your site often.
There are a few hacks to enable you to do this. Here is one that basically allows you to place the CSS code that all browsers understand in your current style sheet, yet hide the more complex, separate style sheet from the browsers that don’t understand the directives contained in it, particularly IE 3 and Netscape 3:
/* CSS style sheet - hide from IE3 and Netscape 3 */ @import url(compliant_browsers.css); |
Because the chances are slim that people are still using these browsers anymore, you will probably want something that deals with newer browsers:
/* CSS style sheet - hide from IE4 */ @import "compliant_browsers.css"; |
Or, for hiding individual properties that render oddly in IE 4 and 5:
color/*This comment is to hide this property from IE4 and IE5 */ : red |
Once you’ve decided whether to use a single style sheet for your CSS design purposes, or particular ones for each browser type, or to simply hide them from outdated browsers that don’t support CSS, it’s time to look at what the workarounds may be for the browser issues we talked about.
Next: Workarounds for Internet Explorer >>
More Style Sheets Articles
More By Jennifer Sullivan Cassidy