css中的類選擇器多關鍵字的兼容問題

當我們在使用類選擇器的時候,經常會使用多個關鍵字來給一個元素添加樣式。如下所示:

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.



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章