How do I target IE compatibility mode for CSS only because i found errors in compatibility but not in standard mode?
1 Answer
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)
1 Comment
Chris Love
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.