由于你正在使用的IE浏览器版本过低,正在遭受无情的鄙视,强烈建议你升级你的IE到最新或者使用chrome/firefox/opera/Safari等浏览器。

浏览器区分方法

文章主要的内容为常用的浏览器区分方法,包括注释、脚本等方法。
【注释区分IE】

<!--[if IE]> Only IE <![endif]-->
所有的IE可识别
<!--[if IE 5.0]> Only IE 5.0 <![endif]-->
只有IE5.0可以识别
<!--[if gt IE 5.0]> Only IE 5.0+ <![endif]-->
高于IE5.0都可以识别
<!--[if lt IE 6]> Only IE 6- <![endif]-->
低于IE6可识别
<!--[if gte IE 6]> Only IE 6/+ <![endif]-->
IE6以及IE6以上都可识别
<!--[if lte IE 7]> Only IE 7/- <![endif]-->
IE7及ie7以下版本可识别
<!--[if !IE]><--><![endif]-->
非ie

lte:Less than or equal to,小于或等于
lt :Less than,小于
gte:Greater than or equal to,大于或等于
gt :Greater than,大于
! :不等于

【CSS Hack】

  1. _ ,只有IE6可以识别
  2. +/*,IE6、7可以识别
  3. IE6支持重定义中的!important如

                .demo1{ color:black!important;color:red;/*显示为红色*/}
                /*重定义*/
                .demo2{color:black!important;}
                .demo2{color:red;}/*显示为黑色*/
              

转载请注明转载自:TOPMING,本文链接地址: http://topming.com/distinguish-browser/

订阅本站:http://topming.com/feed/,投稿联系:gmail

2 则回应给 “浏览器区分方法”

  1. CcChen 说道:

    不錯.現在我做前段UI都不考慮ie6了…唉

  2. reker 说道:


    ie10已经不支持了

发表评论