Click to See Complete Forum and Search --> : Conditional Comments


bp_travis
12-06-2007, 03:32 PM
Hello there. I have a website I am doing that has certain CSS parts that have to have special rules due to IE. Instead of including the condition comments in the header portion of each page, is there a way in the CSS file to make the special rules only for IE? Condition syntax in the CSS? Thanks.

ryanbutler
12-06-2007, 03:46 PM
Nope.

felgall
12-06-2007, 07:36 PM
Microsoft only provide conditional comments for HTML and JavaScript, not for CSS.

boycottIE
12-06-2007, 09:42 PM
You can, however, use the conditional comments to link to a separate stylesheet specifically for IE. This will at least allow you to keep your HTML free of styling. For example:

<!-- Following are workaround for IE rendering problems -->
<!--[if gte IE 7]>
<link href="css/ie7styles.css" rel="stylesheet" type="text/css" />
<![endif]-->


<!--[if lte IE 6]>
<link href="css/ie6styles.css" rel="stylesheet" type="text/css" />
<![endif]-->

felgall
12-06-2007, 11:37 PM
You can, however, use the conditional comments to link to a separate stylesheet specifically for IE.

The original question was whether there was a way to avoid having to do that which has already been answered - No there isn't.

boycottIE
12-06-2007, 11:42 PM
Sorry, I thought his question was whether he had to use in-line styling.... I'm a newb, just trying to help. Hope I didn't insult OP by implying he didn't know how to set up alternate stylesheets!