I use the conditional comments in my page.tpl.php to specify a different CSS class or ID for several DIVs that make up my layout.

After the release of IE8 it seems that I only needed to apply the different CSS for browsers lower IE8. So at least IE8 is more standards compliant than previous versions :)

But changing the conditional comment was less easy. It know works, but I still have problems in Firefox.

I now use this, but it shows '-->' in Firefox (not in Safari). Can anyone show a more elegant and correct conditional that splits the browser space in two: '<=IE7' and 'the rest (including IE8)' ?

Comments

arh1’s picture

no browsers should print any part of your conditional comment tags or stylesheet tags to the screen, so if you're seeing anything like '-->' you should first fix up your markup -- that may likely be the culprit with any other css problems you're having.

that said, here's the markup to include your stylesheet for only IE<8 :

<!--[if lt IE 8]>
<link type="text/css" rel="stylesheet" media="screen" href="/path/to/ie-less-than-8.css" />
<![endif]-->

hth!