1

How do I target IE compatibility mode for CSS only because i found errors in compatibility but not in standard mode?

1
  • Please do some search at SO, there's a ton of good answers to your question. Commented Nov 30, 2013 at 16:24

1 Answer 1

3

Best solution:

Tell IE to use 'Edge' mode (highest available standards):

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

Modernizr:

And then use the classes modernizr gives you to determine the styles for each situation.

Also can use this in your <head> section:

Conditional comments:

<!--[If lte IE9]>
    <link rel="stylesheet" href="ie-styles.css" type="text/css">
<![endif]-->

This says "If less than or equal to Internet Explorer version 9, use ie-styles.css"

you can change the lte (less than or equal to) to gte (greater than or equal to), lt, gt or just leave it out for an exact match. You can combine and negate as well (using & and | for and/or and ! for not)

Here's a good place to see them all.

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

1 Comment

conditional comments are completely ignored in IE 11. There are some differences with IE in compat mode from the actual engines, but by an large they are extremely similar. But the best advice is to force them into edge mode, or the most current engine then do what Deryck suggest and feature detect to polyfil obsolete versions of IE.

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.