Use double classes in IE6 CSS?

前端 未结 3 1067
猫巷女王i
猫巷女王i 2021-01-31 04:39

is there any way to make IE6 understand double classes, say I have a class MenuButton with a color class and possibly a clicked class; like :

.LeftContent a.Menu         


        
3条回答
  •  南方客
    南方客 (楼主)
    2021-01-31 04:55

    IE6 doesn't support multiple class selectors. The reason you see a change with the Orange class is because a.MenuButton.Orange is interpreted by IE6 as a.Orange.

    I recommend structuring your markup in such a way that you can work around this:

    
    

    By grouping by a more specific ancestor you can create variation with classes scoped by that ancestor (in this example navmenu):

    .leftcontent .navmenu a { /* ... basic styles ... */ }
    .leftcontent .navmenu a.orange { /* ... extra orange ... */ }
    .leftcontent .navmenu a.clicked { /* ... bold text ... */ }
    

    It's not as good as multiple classes, but I've used it to work around the lack of support in IE.

提交回复
热议问题