FE-study我爱编程

CSS-浏览器兼容

2017-09-15  本文已影响0人  饥人谷_bigJiao

1.什么是 CSS hack

注:实际项目中CSS Hack大部分是针对IE浏览器不同版本之间的表现差异而引入的。

2.谈一谈浏览器兼容的思路

3.列举5种以上浏览器兼容的写法

  1. 合适的框架

    • Bootstrap (>=ie8)
    • jQuery 1.~ (>=ie6), jQuery 2.~ (>=ie9)
    • Vue (>= ie9)
  2. 条件注释

    • 条件注释 (conditional comment) 是HTML源码中被IE有条件解释的语句。条件注释可被用来向IE提供及隐藏代码。
    <!--[if IE 6]>
    <p>You are using Internet Explorer 6.</p>
    <![endif]-->
    <!--[if !IE]><!-->
    <script>alert(1);</script>
    <!--<![endif]-->
    <!--[if IE 8]>
    <link href="ie8only.css" rel="stylesheet">
    <![endif]-->
    

注: IE10不再支持条件注释

  1. CSS hack
        .box{
            color: red;
            _color: blue; /*ie6*/
            *color: pink; /*ie67*/
            color: yellow\9;  /*ie/edge 6-8*/
        }
<!–-[if IE 7]>
<link rel="stylesheet" href="ie7.css" type="text/css" />
<![endif]–->

  1. IE条件注释法结合选择器整体优化
  2. 利用一些和兼容相关的开发利器

4.以下工具/名词是做什么的

5.一般在哪个网站查询属性兼容性?

上一篇下一篇

猜你喜欢

热点阅读