1 <!doctype html> 2 <html lang="en"> 3 4 <head> 5 <meta charset="UTF-8" /> 6 <title>gradient 兼容性处理</title> 7 <style type="text/css"> 8 * { 9 margin: 0; 10 padding: 0; 11 } 12 13 .parent { 14 width: 100px; 15 height: 100px; 16 margin: 100px; 17 border: 1px solid red; 18 19 /*IE5 IE6 IE7 IE8 IE9 IE10 在属性值后加\9*/ 20 /*background-color: red\9;*/ 21 22 /*IE8 IE9 IE10 在属性值后加\0*/ 23 /*background-color: red\0;*/ 24 25 /*IE9 IE10 在属性值后加\9\0*/ 26 /*background-color: red\9\0;*/ 27 28 /*IE6 IE7 在属性前加星号*/ 29 *background-color: red; 30 31 /*IE6 在属性前加下划线号*/ 32 /*_background-color: red;*/ 33 } 34 </style> 35 </head> 36 37 <body> 38 <div class="parent"> 39 </div> 40 </body> 41 42 </html>
总结:
(1)IE5 IE6 IE7 IE8 IE9 IE10 在属性值后加\9
(2)IE8 IE9 IE10 在属性值后加\0
(3)IE9 IE10 在属性值后加\9\0
(4)IE6 IE7 在属性前加星号
(5)IE6 在属性前加下划线号
以上均可通过上述代码测试。