/    Sign up×
Community /Pin to ProfileBookmark

Conditional Comments

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.

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@ryanbutlerDec 06.2007 — Nope.
Copy linkTweet thisAlerts:
@felgallDec 07.2007 — Microsoft only provide conditional comments for HTML and JavaScript, not for CSS.
Copy linkTweet thisAlerts:
@boycottIEDec 07.2007 — 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:

[CODE]<!-- 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]-->
[/CODE]
Copy linkTweet thisAlerts:
@felgallDec 07.2007 — You can, however, use the conditional comments to link to a separate stylesheet specifically for IE. [/QUOTE]

The original question was whether there was a way to avoid having to do that which has already been answered - No there isn't.
Copy linkTweet thisAlerts:
@boycottIEDec 07.2007 — 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!
×

Success!

Help @bp_travis spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...