Search code examples
javascripthtmlcssinternet-explorer-9

How do I make an "else" in an IE HTML conditional?


<!--[if lt IE 9]>
    This is less then IE9
ELSE
    this is all browsers: firefox, chrome, etc.
<![endif]-->

How do I do this in my HTML? I want to do an "else" ...


Solution

  • You're not looking for an else, you're looking for <![if !IE]> <something or other> <!--[endif]> (note that this is not a comment).

    <!--[if IE]>
       You're using IE!
    <![endif]-->
    <![if !IE]>
       You're using something else!
    <![endif]>
    

    You can find documentation on the conditional comments here.