总是忘记给ie做特殊样式处理,以前打游击,不做也就算了,以后可不行,得对自己的“孩子”负责。。

一、先说IE老大的兼容

知道了一些常用的css属性兼容方法确实可以解决问题,

但我不知道我自己的ieTester是不是假的,很多网上说的ie8能识别、ie6,7不能识别的符号,我的ieTester6,7还是能识别。针对ie的兼容还有后缀\9\0写道一起的方法,说是只针对ie9,其实ie8也可以、怀疑自己用的是假的ie9。

总结了一些,常见的IE hack写法,对比正常写法,列表及实际功能如下

  1.       background: red;            ~非ie
  2.                 background: blue\9;         ~ie所有
  3.                 background: black\0;        ~ie8及以上
  4.       background: blue\9\0;     ~ie8及以上
  5.                 background: yelow\9\0;    ~没用  
  6.          background: blue\0/;        ~ie8 独有
  7.                 +background: grey;         ~没用
  8.                 *background: deeppink;   ~ie7及以下
  9.              _background: green;        ~ie6及以下

总的来说就是,顺序就是:

  1. background: red;
  2.  background: blue\9;
  3. background: goldenrod\0/;
  4. *background: deeppink;
  5.  _background: green;

代码测试如下:

 1 <!DOCTYPE html>
 2 <html>
 3     <head>
 4         <meta charset="UTF-8">
 5         <title>IEHackTest</title>
 6          <meta name="author" content="郭菊锋702004176@qq.com"/>
 7          <style type="text/css">
 8              div{
 9                 width: 300px;
10                 height: 300px;
11                 background: red; 
12                 
13                 background: blue\9;
14                 
15                 background: goldenrod\0/;
16                 
17                  *background: deeppink;
18                 
19                 _background: green; 
20                 }
21          </style>
22     </head>
23     <body>
24         <div></div>
25     </body>
26 </html>
IEhackTest

相关文章:

  • 2021-08-15
  • 2022-12-23
  • 2021-06-08
  • 2022-01-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-29
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
相关资源
相似解决方案