Bob Wrote: > What is the best (correct perhaps) way to place if/else > clauses in CSS? > For instance, if IE - do this, else .... > > I currently use a javascript test to check for which browser, > and if IE > add the relevant CSS. Seems inefficient. Is this a better > option that > can be contained within the stylesheet? > > Bob
Ron, at work on a Saturday, sadly enough, replied: Bob, you want to ditch that browser detection script because it doesn't work, as many browsers can spoof their identity and pretend to be IE, etc. Instead, you should code to standards and tweak that for the browsers you wish or need to support by feeding them their own alternate code. Personally I first test my pages in Firefox, as it seems to be the most standards-compliant, then in all other browsers, leaving IE for last typically. For IE on the PC, you can use conditional comments to feed specific css to only that browser. You can even filter for different versions. CC's are placed in the head of the HTML document itself. [0] In most cases, you will only need to give IE alternate css, as most other current browsers are standards based. There is no if/then/else in CSS, as it is not a programming or scripting language. Read up on the conditional comments and if you have specific issues, please feel free to post back to the group detailing your problems. Hope that helps! Regards, Ron [0] http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.as p ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
