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 小于或等于

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

  • 相关阅读:
    vue报错:Not Found
    使用Vue DevTools 插件报错的问题:Vue.js is detected on this page. Open DevTools and look for the Vue panel.
    Linux安装docker
    asp.net5.0源码(Microsoft github源码)
    探索Asp net core3中的 项目文件、Program.cs和通用host(转)
    c#中的sealed关键字
    .NET平台常见技术框架整理汇总
    疫情下孩子的网课
    常系数齐次线性递推
    【2021~2022】模拟赛乱写 Period I
  • 原文地址:https://www.cnblogs.com/nianshi/p/2000687.html
Copyright © 2011-2022 走看看