在IE6 CSS中使用双类? [英] Use double classes in IE6 CSS?

查看:96
本文介绍了在IE6 CSS中使用双类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有任何方法使IE6理解双类,
说我有一个类MenuButton与颜色类和可能的点击类;
like:

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.MenuButton {..general rules..}  
.LeftContent a.MenuButton.Orange {..sets background-image..}  
.LeftContent a.MenuButton.Clicked {...hum ta dum...}

现在,IE6理解< a class =MenuButton Orange> ,但是当添加
点击,像< a class =MenuButton Orange Clicked> ,IE只是忽略了
Clicked规则。

Now, IE6 understands <a class="MenuButton Orange">, but when adding Clicked, like <a class="MenuButton Orange Clicked">, IE just ignores the Clicked rule.

当然,我可以重写我的CSS,并有自己的规则.MenuButtonOrange

和这样(它可能需要比提出这个问题更短的时间;-),

but golly,it just so unappealing and Web 0.9 ...

Of course, I could rewrite my CSS, and have own rules for .MenuButtonOrange
and such (and it'd probably taken a lot shorter time than asking this question ;-),
but golly, it just so unappealing and Web 0.9...

干杯!

推荐答案

IE6不支持多个类选择器。使用 Orange 类看到更改的原因是因为 a.MenuButton.Orange 被IE6解释为 a.Orange

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:

<div class="leftcontent">
   <ul class="navmenu">
     <li><a class="menubutton orange" href="#">One</a></li>
     <li><a class="menubutton orange clicked" href="#">Two</a></li>
   </ul>
</div>

通过更具体的祖先进行分组,您可以使用由该祖先设置的类创建变体 navmenu ):

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 ... */ }

它不如多个类好,使用它来解决在IE中缺乏支持。

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

这篇关于在IE6 CSS中使用双类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆