zoukankan      html  css  js  c++  java
  • 用CSS如何判断IE浏览器版本?


    之前只是针对所有的IE浏览器:

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

    要避掉IE8的话就得:

    <!--[if lt IE 8]>   <link href="Style/IE.css" rel="stylesheet" type="text/css" /> <![endif]-->

    lt在此作小于用,也就是小于IE8的版本都能识别。

    或者:

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

    lte在此作小于及等于用,也就是小于及等于IE7的版本能识别。

    或者:

    <!--[if !(IE 8)]>   <link href="Style/IE.css" rel="stylesheet" type="text/css" /> <![endif]-->

    <!–[if !(IE 8)]><![endif]–>在此单独避掉IE8版本。

    在网上找了以下代码,测试了下有几个不符合:

    1. <!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]--> 2.  <!--[if IE]> 所有的IE可识别 <![endif]--> 3. <!--[if IE 5.0]>  只有IE5.0可以识别 <![endif]--> 4. <!--[if IE 5]> 仅IE5.0与IE5.5可以识别  <![endif]--> 5. <!--[if gt IE 5.0]> IE5.0以及IE5.0以上版本都可以识别  <![endif]--> 6. <!--[if IE 6]> 仅IE6可识别 <![endif]--> 7. <!--[if lt IE 6]> IE6以及IE6以下版本可识别 <![endif]--> 8.  <!--[if gte IE 6]> IE6以及IE6以上版本可识别 <![endif]--> 9. <!--[if  IE 7]> 仅IE7可识别 <![endif]--> 10. <!--[if lt IE 7]>  IE7以及IE7以下版本可识别 <![endif]--> 11. <!--[if gte IE 7]>  IE7以及IE7以上版本可识别 <![endif]-->

    经过测试后:

    5. <!--[if gt IE 5.0]> IE5.0以及IE5.0以上版本都可以识别 <![endif]-->

    这个只有IE6以上的版本才可识别,也就是不包括IE5.0

    7. <!--[if lt IE 6]> IE6以及IE6以下版本可识别 <![endif]-->

    这个只有IE5以下的版本才能识别,也就是不包括IE6

    10. <!--[if lt IE 7]> IE7以及IE7以下版本可识别 <![endif]-->

    这个只有IE6以下的版本才能识别,也就是不包括IE7

    后来才在经典那找到:

    gt = Great Then 大于 &gt; = > 大于号 lt = Less Then  小于 &lt; = < 小于号 gte = Great Then or Equal 大于或等于 lte = Less Then  or Equal 小于或等于

    一下就明白过来了,还费了那么大劲。

  • 相关阅读:
    jquery toggle(listenerOdd, listenerEven)
    struts quick start
    hdu 1518 Square (dfs)
    hdu 2544 最短路 (最短路径)
    hdu 1754 I Hate It (线段树)
    hdu 1856 More is better (并查集)
    hdu 1358 Period (KMP)
    hdu 2616 Kill the monster (DFS)
    hdu 2579 Dating with girls(2) (bfs)
    zoj 2110 Tempter of the Bone (dfs)
  • 原文地址:https://www.cnblogs.com/nianshi/p/2000687.html
Copyright © 2011-2022 走看看