0

We recently redesigned our public-facing site, however one item was not fully communicated.

A certain portion of our site uses some of the newer display types in CSS. This looks fine in almost all browsers, but not in IE8's compatibility mode or in IE7.

This wouldn't be an issue, except the miscommunicated item was that we DO need to support IE7.

For this reason, my initial fix (forcing IE8 into standards mode) was rejected.

I'm currently developing a CSS to override these sections of the page. We want this to be a separate CSS file, not to use CSS hacks within the main stylesheet for maintainability reasons.

My understanding is that I can include this (or not) by using IE's conditional comments to include it only for version IE7 and below. If I use the conditional comment

<!-- if lte IE 7>

will this also be included with IE8's Compatibility Mode? If not, how do I specifically target IE 8 Compatibility?

Jeff
  • 2,835
  • 3
  • 41
  • 69
  • 2
    Have you read this? http://stackoverflow.com/questions/3140116/determine-if-in-ie8-compatibility-mode-using-conditionals – Andrew Oct 10 '12 at 20:20
  • could this help: http://stackoverflow.com/questions/10579753/conditional-comment-for-ie-9-compatibility-mode ? – greener Oct 10 '12 at 20:20
  • @andrewap: No, I hadn't found that question, despite searching. That does, however, lead me to thinking about a new technique... – Jeff Oct 10 '12 at 20:24

1 Answers1

2

At least in IE9, IE does function as IE7 as for conditional comments. For example, with following code:

<!--[if IE 7]>IE7.<![endif]-->
<!--[if IE 8]>IE8.<![endif]-->
<!--[if IE 9]>IE9.<![endif]-->

"IE7" will be shown in IE9 working in compatibility view mode triggered via a button at the right of location bar.

Update: just tested in IE8 — it does the same as IE9.

Marat Tanalin
  • 13,927
  • 1
  • 36
  • 52
  • This is good, but doesn't help me with IE 8's compatibility mode. Thank you for the response anyway. – Jeff Oct 10 '12 at 20:28
  • Interesting - that directy contradicts the accepted answer for [this question](http://stackoverflow.com/questions/3140116/determine-if-in-ie8-compatibility-mode-using-conditionals). – Jeff Oct 10 '12 at 20:40
  • That question is probably about determining exactly IE8 in compatibility mode and distinguishing it from true IE7 (they cannot be distinguished via Conditional Comments). – Marat Tanalin Oct 10 '12 at 20:47