您的位置:首页 > Web前端 > CSS

css中的类选择器多关键字的兼容问题

2015-04-08 22:17 267 查看
当我们在使用类选择器的时候,经常会使用多个关键字来给一个元素添加样式。如下所示:

CSS代码:

<span style="font-size:18px;">p.warning.help {background: red;}</span>

HTML代码:
<span style="font-size:18px;"><p class="urgent warning help">Help me!</p></span>


In versions previous to IE7, Internet Explorer for both platforms has problems with correctly handling multiple class selectors. In these older versions, although you can select a single class name out of a list, selecting based
on multiple names in a list does not workproperly.Thus, p.warning would workas expected, but p.warning.help would

match any p elements that have a class attribute with the word help because it comes last in the selector. If you wrote p.help.warning, then older versions of Explorer would match any p elements that have warning in their class value, whether or not help appears
in the same value.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  css class 兼容