如何处理css与IE兼容性问题

html-css028

如何处理css与IE兼容性问题,第1张

CSS hack的写法大致归纳为3种:条件hack、属性级hack、选择符级hack。 (1)条件hack主要针对IE浏览器进行一些特殊的设置 <!--[if<keywords>? IE <version>?]>代码..

.test{ /* 1. */\x0d\x0a\x0d\x0a/* color:#09F\0以前是IE8/9, 现在10也支持 */\x0d\x0a\x0d\x0acolor:#09F\0//* 以前是IE8 only, 现在IE9/10也支持. 如要排除IE9需要使用下面的rule重设IE9样式 */\x0d\x0a\x0d\x0a}\x0d\x0a\x0d\x0a@media all and (min-width:0) { /* 2. */\x0d\x0a\x0d\x0a.test{color:red\9}/* IE9 only, 现在IE10也支持 */\x0d\x0a\x0d\x0a/* Ps:老外的方法都是\0,根本没考虑Opera */\x0d\x0a\x0d\x0a}\x0d\x0a\x0d\x0a@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { /* 3. */\x0d\x0a\x0d\x0a .test { color: green} /* IE10+ */\x0d\x0a\x0d\x0a}\x0d\x0a\x0d\x0a:root .test { color:#963\9} /* 以前IE9 only, 现在10也支持, 优先级高于@media, 优先级太高, 尽量少用 */