i have this markup which works fine:
<div id="hd1" class="header headerNotIE6">
i am now trying to put a ie6 specific workaround so i am trying to only have this div if the browser is not IE 6. So i want this line to hit if its IE7, 8 and firefox and chrome. I tried this but it doesn't seem to work in Firefox or Chrome.
<!--[if !(IE 6)]>
<div id="hd1" class="header headerNotIE6">
<![endif]-->
is there any "if everything but IE6" conditional comment that works in an html file ??
What you have to use is
Browsers other than IE see
<!--[if !IE 6]><div id="hd1" class="header headerNotIE6"><![endif]-->
as a normal comment, so they don't ever get to see thediv
inside.To target any IE except IE6, you use the
!
operator:To target any IE except IE6 as well as all other browsers, you need special syntax to break out of the conditional comments so other browsers can read and parse the HTML inside, instead of seeing the entire block as one comment:
The original syntax as shown in voyager's answer, known as downlevel-revealed syntax, lacks the extra comment delimiters. However, it is invalid HTML, so to maintain document validity you should use the above syntax instead.