开发者

Does CSS have a selector for selecting when in more than one class? [duplicate]

This question already has answers here: CSS Selector that applies to elements with two classes (2 answers) 开发者_如何学运维 Closed 9 years ago.

I have the following:

<a class="nav disabled">Test</a>

Is there some way I can specify the background-color if the address has BOTH the "nav" and "disabled" class markers? In other words a selector that will select only the last of the three below:

<a class="nav">Test1</a>
<a class="disabled">Test2</a>
<a class="nav disabled">Test3</a>


Yes.

.nav.disabled { .... }

this has side effects in IE6, but is otherwise supported by every browser.


Concatenate the class selectors:

a.nav.disabled


CSS rule for

<a class="nav disabled">Test3</a>

is

a.nav.disabled {}

or

.nav.disabled {}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜