2014年2月20日
CSS hack 总结
直接看Demo,自动识别浏览器的,可以在不同浏览器下看看效果。
*property:value; | IE6 IE7 |
+property:value; | IE6 IE7 |
_property:value; | IE6 |
*:first-child+html div {background-color:black; } | IE7 |
property:value\0; | IE8 IE9 IE10 |
property:value\0\9; | 其实和\0是一样的 |
property:value\9; | 所有IE |
property:value\9\0; | IE9 IE10 |
* html #test { … } | IE6 |
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { #ie10 { color: red; } } | IE10 |
@media all and (min-width:0px){ div {background-color:black\0;} } | 之前测试是Oprea的,但是现在IE9,IE10也生效了 |
@media all and (min-width:0px){ div {background-color:black;} } | 之前测试是非IE的,但是现在IE9,IE10也生效了 |
看demo里面其实写的很明白了,现在的问题是最后两个 Hack 在 IE9 和 IE10 下面神奇的生效了(我用的是IE10,调整浏览器模式测试的),除了这两个,其他的都还比较OK,和我一年的测试效果是一致的,大家可以自己打开看看效果,欢迎交流。
其实我一直不赞成使用太多 hack,只有个别问题在低版本IE下才有使用hack的必要。
标签:CSS
哇。辛苦了!