开发者

Select div if it has both classes - valid CSS?

In firefox the following CSS is only applied to the last div, as its the only div with both classes:

开发者_C百科
.a.b {
color: red;
}

<div class="a"> Stuff A</div>
<div class="b"> Stuff B</div>
<div class="a b"> Stuff A and B</div>

Is this valid CSS? Im just worried as ive never heard of it before. Thanks


This is valid css. Almost all browsers support multiple class selector except ie6

Browser support s
Mac: Safari 4.0 supported
Mac: Chrome 5.0 supported
Mac: FireFox 3.6    supported
Mac: Opera 10   supported
Win: FireFox 3.6    supported
Win: Opera 10   supported
Win: IE6    NOT SUPPORTED
Win: IE7    supported
Win: IE8    supported

Source: http://www.maxdesign.com.au/articles/multiple-classes/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜