So whos using conditional comments?

Soldato
Joined
18 Oct 2002
Posts
9,598
Location
Sunderland
Im currently working on a site that I tested with the IE7 b2 yeseterday, and came across the problems that IE7 ignores CSS hacks. Althought that I have read that they will re introduce the support for the hacks into the final release, it lead me down the line of trying to make the site compatible without the use of CSS hacks.

This in turn lead me onto conditional comments, and the eventual solution of creating a separate css file for older versions of IE, to fix the box model problem.

There is an example of this listed here

The problem I had with this was that I couldnt test previous versions of IE, I have been running standalone versions of IE5 in the past however conditional comments didnt work, as it always detected the version of IE installed in the OS. So I stumbled accros this page which allows multiple versions to run correctly, and with conditional comments working.

So now my CSS is hack free, only using IE conditional comments to import a CSS file for versions less than 6, and everything seems fine.

There will be a time when the hacks are phased out and for me, it starts now. Is anyone else implementing this, or nor? What are your views?
 
Yes, that's what I do on every site I work on, and have done so for the past couple of years :D. It's the safest, cleanest and most efficient option in my opinion. I only use hacks in my main stylesheet when I'm limited for time, or there's some other reason why separate CSS isn't appropriate.

A clean master 'conforming' stylesheet that's appropriate for any browser, then separate stylesheets for browser-specific code, invalid hacks and proprietary rules. Hacks are unstable things; you just don't know what one might trigger in browser x, that it does in browser y. So I like to be safe in the knowledge that hacks are only ever served to the browser they were intended for.

IE7 isn't ignoring the hacks, it's just that the relevant parser bugs have been fixed - things like * html - but the renderer bugs still remain in the beta. I would avoid trying to factor in code for IE7 at this point in time :).
 
Back
Top Bottom