判断IE6 CSS 通过判断浏览器类型而加载不同的css样式

所有IE都起作用:

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

IE以外浏览器起作用:

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

只有IE7起作用:

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

只有IE6起作用:

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

只有IE5起作用:

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

只有IE5.5起作用:

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

只对IE6及以下版本起作用:

<!--[if lt IE 7]>  <link rel="stylesheet" type="text/css" href="ie6-and-down.css"/> <![endif]-->
<!--[if lte IE 6]>  <link rel="stylesheet" type="text/css" href="ie6-and-down.css"/> <![endif]-->

只对IE7及以下版本起作用:

<!--[if lt IE 8]>  <link rel="stylesheet" type="text/css" href="ie7-and-down.css"/> <![endif]-->
<!--[if lte IE 7]>  <link rel="stylesheet" type="text/css" href="ie7-and-down.css"/> <![endif]-->

只对IE8及以下版本起作用:

<!--[if lt IE 9]>  <link rel="stylesheet" type="text/css" href="ie8-and-down.css"/> <![endif]-->
<!--[if lte IE 8]>  <link rel="stylesheet" type="text/css" href="ie8-and-down.css"/> <![endif]-->

只对IE6及以上版本起作用:

<!--[if gt IE 5.5]>  <link rel="stylesheet" type="text/css" href="ie6-and-up.css"/> <![endif]-->
<!--[if gte IE 6]>  <link rel="stylesheet" type="text/css" href="ie6-and-up.css"/> <![endif]-->

只对IE7及以上版本起作用:

<!--[if gt IE 6]>  <link rel="stylesheet" type="text/css" href="ie7-and-up.css"/> <![endif]-->
<!--[if gte IE 7]>  <link rel="stylesheet" type="text/css" href="ie7-and-up.css"/> <![endif]-->

只对IE8及以上版本起作用:

<!--[if gt IE 7]>  <link rel="stylesheet" type="text/css" href="ie8-and-up.css"/> <![endif]-->
<!--[if gte IE 8]>  <link rel="stylesheet" type="text/css" href="ie8-and-up.css"/> <![endif]-->

三、通常对IE6做这样处理:
(本站就是这样处理)
对于IE6及以下版本处理是很具有挑战性.近来,人们都在呼吁对IE6要太在意,包括一些企业,一些网络应用,甚至是政府。现在有一个比让这些在 IE6下让人惨忍睹网站下地域更好解决方案,那就是单独写一个针对IE6精简CSS样式表,这样至少会影响人们浏览网页主要内容。然后再写一个IE6以上版本及其它浏览器正常CSS,这样是很好?

<!--[if !IE 6]><!-->   <link rel="stylesheet" type="text/css" media="screen, projection" href="REGULAR-STYLESHEET.css" /> <!--<![endif]-->   <!--[if gte IE 7]>   <link rel="stylesheet" type="text/css" media="screen, projection" href="REGULAR-STYLESHEET.css" /> <![endif]-->   <!--[if lte IE 6]>   <link rel="stylesheet" type="text/css" media="screen, projection" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" /> <![endif]-->

四、如果你非要用HACK来解决话……请往下看
只对IE7起作用:

* html #div {     height: 300px; }

对非IE7起作用:

#div {     _height: 300px; }

只对IE6以上版本起作用:

#div {    height/**/: 300px; }
html->body #div {       height: 300px; }

对于IE6及以下版本的处的更多相关文章

  1. 兼容ie6及一下版本的自适应

    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" /> <meta ...

  2. IE6及以上版本fixed问题解决方案,页面右下角固定页面,可以最大化、最小化、正规显示

    在窗口固定位置显示内容使用fixed,但是 IE 6 不支持,后来我搜了很多方法,都没有作用,后来类比着一个网站的代码,使用absolute .z-index解决了问题. 页面div结构: <d ...

  3. CSS3 Pie工具可以让IE6至IE8版本实现大多数的CSS3修饰特性,如圆角、阴影、渐变等

    css3 pie使用方法: <!doctype html> <html lang="en"> <head> <meta charset=& ...

  4. 关于IE6中做兼容的那点事。

    前言 对于程序员来说,一听到你做的程序必须兼容IE6(当然主流浏览器肯定得兼容的),那颗滚烫的心瞬间哇凉哇凉的,但是有时,项目就要求这样,你也只能硬着头皮跟IE6来个亲密接触,最近正好做了个项目,关于 ...

  5. 如何让CSS区别IE版本

    关于IE浏览器实在太坑爹了,但你又不得不去解决它,不过就本人所知,IE8—IE10差别不大,至少本人还没有遇到过在IE8环境下到了IE9及以上版本就出现坑爹的问题,但我们又不得不面对IE8以下的版本, ...

  6. IE6 BUG及解决方案

    1.IE6中奇数宽高的BUG 一个外部的相对定位div,内部一个绝对定位的div(right:0) 可是在IE6下查看,却变成了right:1px的效果了: 解决方案就是将外部相对定位的div宽度改成 ...

  7. fasicon.js (无二维码版,如需要js创建二维码版本可联系我:770959294@qq.com)

    /*** Created by 张云山 on 2016/12/9.*/(function(wins,doct){wins.fasicon = function(){this.name = " ...

  8. IE环境下判断IE版本的语句...[if lte IE 6]……[endif][if lte IE 7]……[endif]

    <!--[if IE 6]> <![endif]--> 只有IE6版本可见 <!--[if lte IE 6]> <![endif]--> IE6及其以 ...

  9. 区分IE版本的三个方法

    我们通常使用IE条件判断语言来处理IE的CSS问题,但其实还是有其他的一些方法来处理IE的CSS bug的. 一.IE条件判断语句 IE条件判断语句也许是用的最多的区分IE版本(IE6, IE7, I ...

随机推荐

  1. 黑马程序猿 IO流 ByteArrayInputStream与ByteArrayOutputStream

    ---------------------- ASP.Net+Unity开发..Net培训.期待与您交流! ---------------------- package cn.itcast.IO; i ...

  2. 跨服务器查询sql语句样例

    若2个数据库在同一台机器上:insert into DataBase_A..Table1(col1,col2,col3----)select col11,col22,col33-- from Data ...

  3. 飘逸的python - 解决一个有限制的组合需求

    假设有一个团队技能的需求. 这类技能是要集齐所有指定的人就能激活. 但是因为同一个人又2种身份存在,比如杨戬/神杨戬,于是便产生了组合. 这种组合跟普通组合不一样,普通组合可以随意组合.而这种组合是每 ...

  4. HDU 1863:畅通project(带权值的并查集)

    畅通project Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  5. undefined和null的区别

    在javascript中undefined和null几乎是没有区别的 undefined==null;//true;   区别:   null是一个表示“无”的对象,转为数值为0:或者说没有对象,此处 ...

  6. Android中获取apk基本信息

    一 PackageManager可以获得的所有包节点信息: 1,所有节点的基类:PackageItemInfo: 2,PackageInfo:package的全面信息,与AndroidManifest ...

  7. 加载为应用程序池‘DefaultAppPool'提供服务的进程失败,应用程序池被禁用【解决方法】

    iis应用程序池不能启动2008年03月13日 星期四 15:29iis应用程序池不能启动.WINDOWS2003 ENT SERVER(64位)环境下(测试过32位系统一样操作无此问题),当打开“应 ...

  8. mysql 数据库连接池

    hibernate配置C3P0详解         分类:             hibernate              2013-08-14 16:16     1213人阅读     评论 ...

  9. javaScript动态添加样式

    [动态添加css样式] <html> <head> <script type="text/javascript"> window.onload= ...

  10. Struts2 标签库详解2

    Struts2标签库 包括: OGNL Struts2标签分类 控制标签 :(if, elseif,else, iterator, append, merge, generator, subset, ...