Search code examples
htmltemplatesinternet-explorer-7internet-explorer-6conditional-comments

HTML Comments to detect IE6 and IE7


<!--[if IE 6]>
I am using IE6
<![endif]-->

That works.

How do I do "or" IE7?


Solution

  • If you, for whatever reason, what to only test for IE6 or IE7, and maybe have some other conditions for IE5 elsewhere, there is also support for other operators:

      <!--[if (IE 6)|(IE 7)]>
        This is IE 6 or IE 7!
      <![endif]-->
    

    Check out the wikipedia article which has better documentation than Quirksmode on this.