0

Im trying to use conditional stylesheets to target different versions of IE.

I have the following

<!--[if IE 7]>
<link href="_includes/css/ie7.css" rel="stylesheet">
<![endif]-->
<!--[if gte IE 7]>
<link href="_includes/css/ie7.css" rel="stylesheet">
<![endif]-->
<!--[if lte IE 7]>
<link href="_includes/css/ie6.css" rel="stylesheet">
<![endif]-->

Which works okay, but in IE8 it seems to pickup ie6.css and I cant for the life of me figure out why. Has anybody any idea?

Thanks


Ive also used

<!--[if IE 8]>

with no luck

2
  • 1
    See if this helps: stackoverflow.com/questions/5835485/css-for-ie-8-only Commented Aug 3, 2011 at 10:32
  • "Has anybody any idea?" No, it can't be… But another hint: if IE 7 and if gte IE 7 both includes ie7.css, so its doubled somehow; Commented Aug 3, 2011 at 10:33

2 Answers 2

2

lte means less than or equal to, therefore you probably want:

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

I'd guess it's possible IE 8 is identifying as IE 7 because it's in compatibility mode. Check your DOCTYPE is correct.

Sign up to request clarification or add additional context in comments.

Comments

1

Ahhh I figured it out!

<!--[if IE 6]>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.