2011-06-14 138 views

回答

8

具有一流的音符,并在同一时间

喜欢的东西<div class='note note_expanded'>将匹配note_expanded核实。

+0

强制性链接到IE6废话解释说:http://stackoverflow.com/questions/3772290/css-selector-that-applies-to-elements-with-two-classes/3772305# 3772305 – BoltClock 2011-06-14 22:29:40

+6

@BoltClock:我认为我们作为开发人员有责任组建一个非凡的开发人员联盟,主要是让任何人仍然使用该浏览器。 – Robert 2011-06-14 22:31:21

+0

我在哪里注册? – BoltClock 2011-06-14 22:32:14

2

这将针对一个div,它既有一个类.note,也有一个.note_expanded类。

<div class="note note_expanded">I'm special!</div>

1
<style> 
div.note.note_expanded { 
    color:blue; 
} 
div.note { 
    color:red; 
} 
div.note_expanded { 
    color:black; 
} 
</style> 
<div class='note note_expanded'> 
This is blue but I would think there must be an easier way. 
</div> 
+0

+1为特异性,但“更简单的方法”做什么? – BoltClock 2011-06-14 22:45:02

+0

的确,完全取决于人们想要做什么:p – 2011-06-14 23:14:33

+0

当我从元素.class {}移除元素到element.class {}的空间时,我的工作停止了吗?为什么???? – 2013-05-06 20:32:27