判断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. XCode中在提示窗体中对已弃用的API接口画上红线

    当我们在XCode中写程序时会不断的出现相关API提示窗体,那敲起来是一个爽啊. 有时候会看到一些API已经弃用了被画上红色的横线.说明该接口已经被弃用,仍保留,但不建议使用,对弃用API实现画横线事 ...

  2. sql注入数据库修复方法

    1.第一种情况是 需要将指定的 注入字符串全部替换掉(仅替换注入的字符串为空) declare @delStr nvarchar(500) set @delStr='<script src=ht ...

  3. 在Ubuntu上为Android系统的Application Frameworks层增加硬件访问服务

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/6578352 在数字科技日新月异的今天,软件和硬 ...

  4. simplify the life ECMAScript 5(ES5)中bind方法简介

    一直以来对和this有关的东西模糊不清,譬如call.apply等等.这次看到一个和bind有关的笔试题,故记此文以备忘. bind和call以及apply一样,都是可以改变上下文的this指向的.不 ...

  5. Android-----输入法的显示和隐藏

    /** * 控制手机虚拟键盘的显示和隐藏 */public class InputMethodUtil { /** * 隐藏虚拟键盘 * @param v  参数v为获取焦点对象view */ pub ...

  6. PHP学习笔记二十九【接口】

    <?php //定义接口 //接口可以定义属性,但必须是常量而且是public //接口的所有方法必须是public interface Iusb{ public function start( ...

  7. Xcode no visible @interface for xxx declares the selector errors

  8. [Leetcode] Search In Rotated Sorted Array (C++)

    题目: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7  ...

  9. OFBiz应用https与http方式访问切换

    url.properties port.https.enabled=N port.https=8444 force.https.host=

  10. [ofbiz]service中OUT的定义

    在service中返回的任何一个结果,比如map1,map2,然后这两个map又封装在另一个map中,则service的定义中,要将map1和map2定义为OUT类型 LOFTER:我们的故事   h ...