Search code examples
htmlcssinternet-explorer-7conditional-comments

how can [if IE 6] can be taken by IE7?


I am adding an aditional stylesheet for IE6

<!--[if IE 6]>
        <link href="../../nCss/comunHome_ie6.css" rel="stylesheet" type="text/css" />
<![endif]-->

but is affecting to IE7 aswell,

edit-

even with

<!--[if lte IE 6]>
        <link href="../../nCss/comunHome_ie6.css" rel="stylesheet" type="text/css" />
<![endif]-->

Any idea why?

-edit2-

Also, with

    function isIE()
                // Returns the version of Internet Explorer or a -1
                // (indicating the use of another browser).
                {
                  var rv = -1; // Return value assumes failure.
                  if (navigator.appName == 'Microsoft Internet Explorer')
                  {
                    var ua = navigator.userAgent;
                    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
                    if (re.exec(ua) != null)
                      rv = parseFloat( RegExp.$1 );
                  }
                  return rv;
                }
alert(isIE());  

it outputs 7...


Solution

  • You could just add an option for IE 7 aswell?

    <!--[if IE 7]>
    Special instructions for IE 7 here
    <![endif]-->
    

    Hmm I suppose you could use if and if !

    Example usage IF I think this should work..

    <!--[if (IE 6)&(!IE 7)]>