2011-06-14 204 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