Is there any way to get IE8 to not ignore a CSS rule that it only partially understands?

情到浓时终转凉″ 提交于 2019-12-10 03:54:38

问题


I just ran into what seems like absurd behavior to me. If IE8 doesn't understand part of a rule it ignores the entire thing:

input[type=radio]:checked,
input.checked {
    /* Some CSS */
}

I already have IE8 specific JS adding the .checked class, but because it doesn't understand :checked, it ignores the entire thing, so I'm forced to now have several rules:

input[type=radio]:checked{
    /* Some CSS */
}
input.checked {
    /* The exact same CSS */
}

So my question -- does anyone know of a way to get IE8 and below to ignore the :checked instead of throwing out the entire rule?

Very basic example: http://jsfiddle.net/8UT56/


回答1:


You can use a library like http://selectivizr.com/ to give IE newer selectors.



来源:https://stackoverflow.com/questions/5968867/is-there-any-way-to-get-ie8-to-not-ignore-a-css-rule-that-it-only-partially-unde

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!