Nested conditional comments
It looks like the issue below was actually down to caching - Doh! The and/or operators work fine in IE 5.5 through 8, and will be what we are using. I'll leave this post here to point out that they are quite useful, especially if you are leaving IE<6 with basic styles.
In a recent test with Internet Explorer's conditional comments, some of the more complex operators didn't seem to work. For example, trying to target IE 6 and 7 defensively, this 'and' operator should work:
<!--[if (gte IE 6)&(lt IE 8)]>
[import this style sheet]
<![endif]––>
However, that didn't seem to work when testing in virtual machines, only the first part did. It was the same for the 'or' version as well, it just counted as greater than or equal to Internet Explorer 6.
Since we can't move CSS based conditional comments into the CSS, what did work in our testing was this slightly inelegant nested version:
<!--[if lt IE 8]>
<![if gte IE 6]>
[import this stylesheet.]
<![endif]>
<![endif]––>
Can anyone else replicate this? I've a quick test page to see if you can point a 5.5 / 6 / 7 / 8 IE browser at it.
- ← Previous
Where SEO and accessibility collide - Next →
ABBR pattern accessibility