• html兼容ie浏览器的写法


    <!DOCTYPE HTML>
    <!--[if !IE]><!--><html lang="zh-cn"><!--<![endif]-->
    <!--[if gt IE 9]><html class="ie10" lang="zh-cn"><![endif]-->
    <!--[if IE 9]><html class="ie9 lte9" lang="zh-cn"><![endif]-->
    <!--[if IE 8]><html class="ie8 lte9 no-css3" lang="zh-cn"><![endif]-->
    <!--[if IE 7]><html class="ie7 lte9 lte7 no-css3" lang="zh-cn"><![endif]-->
    <!--[if lte IE 6]><html class="ie6 lte9 lte7 no-css3" lang="zh-cn"><![endif]-->
    <head>
      <meta charset="UTF-8">
      <title></title>
    </head>
    <body>
      
    </body>
    </html>

    这个其实有好几种不同的版本,按个人的需求来定吧,本人在不同阶段也使用了不同的版本,最终确认为这个版本。其中.no-css3用来表示 ie6-8不支持css3的样式,对于渐进增加方面,可以高级浏览器使用css3,ie6-8使用.no-css3这个class来定位使用背景图片,而 对于ie8支持的:before和:after生成的三角,则可以使用.lt7来表示ie7及ie6使用背景图片。

    再次更新下,因为考虑到国内浏览器还是ie6比较多,所以把顺序排列了下,然后只针对非ie6,7,8进行判断

    <!DOCTYPE HTML>
    <!--[if lte IE 6]><html class="ie6 lte7 no-css3" lang="zh-cn"><![endif]-->
    <!--[if IE 8]><html class="ie8 no-css3" lang="zh-cn"><![endif]-->
    <!--[if IE 7]><html class="ie7 lte7 no-css3" lang="zh-cn"><![endif]-->
    <!--[if !(IE 6) | !(IE 7) | !(IE 8)  ]><!--><html lang="zh-cn"><!--<![endif]-->
    <head>
      <meta charset="UTF-8">
      <title></title>
    </head>
    <body>
      
    </body>
    </html>

    2013-01-05更新:添加ie9,把no-css3 class改成lte8

    <!DOCTYPE HTML>
    <!--[if IE 6]><html class="ie6 lte9 lte8 lte7" lang="zh-cn"><![endif]-->
    <!--[if IE 8]><html class="ie8 lte9 lte8" lang="zh-cn"><![endif]-->
    <!--[if IE 9]><html class="ie9 lte9" lang="zh-cn"><![endif]-->
    <!--[if IE 7]><html class="ie7 lte9 lte8 lte7" lang="zh-cn"><![endif]-->
    <!--[if !(IE 6) | !(IE 7) | !(IE 8) | !(IE 9)  ]><!--><html lang="zh-cn"><!--<![endif]-->
    <head>
    <meta charset="UTF-8">
    <title></title>
    </head>
    <body>
    
    </body>
    </html>

    以上是网上转发的,咱们实际使用中的可以考虑的更简单

    <!DOCTYPE html>
    <!--[if lt IE 7 ]><html class="ie6" lang="zh-cn"><![endif]-->
    <!--[if IE 7 ]><html class="ie7" lang="zh-cn"><![endif]-->
    <!--[if IE 8 ]><html class="ie8" lang="zh-cn"><![endif]-->
    <!--[if IE 9 ]><html class="ie9" lang="zh-cn"><![endif]-->
    <!--[if (gt IE 9)|!(IE)]><!--><html class="" lang="zh-cn"><!--<![endif]-->

    这样就可以了,例如当类a某个样式在ie8上有问题时,就可以写成

    .ie8 .a{}
  • 相关阅读:
    MongoDB学习笔记(五) MongoDB文件存取操作(转)
    MongoDB学习笔记(四) 用MongoDB的文档结构描述数据关系(转)
    Log4net配置相关
    UML 依赖 关联 聚合 组合
    亲属称谓
    Unity预定义程序集及自定义包编译顺序
    For Windows Phone8 phones make sure that the Windows Phone IP Over USB Transport(IpOverUsbSvc) service is running
    提升Entityframework效率的几种方法
    将RDLC报表工具栏中的英文改为中文
    C#函数式程序设计初探——基础理论篇
  • 原文地址:https://www.cnblogs.com/snowbaby-kang/p/3992971.html
Copyright © 2020-2023  润新知