2013-03-19 37 views
0

我正在尋找僅在出現兩個類時發生的情況。僅當兩個類共存時才匹配的CSS規則

如:

.positive{ 
    color:#46a546; 
} 
.positive:after{ 
    content: "\25b2"; 
} 
.negative{ 
    color:#F00; 
} 

.arrow:after{ 
    content: "\25bc"; 
} 

<span class="positive"> hi </span> 
<span class="positiveArrow"> hi </span> 
<span class="negativeArrow"> hi </span> //what i have 

<span class="positive arrow"> hi </span> 
<span class="negative arrow"> hi </span> // what i want 
+0

你的問題沒有意義。請編輯你的問題。 – 2013-03-19 17:10:29

+0

第一次擊中「僅當存在兩類時發生的事情」是核受體:D – Alex 2013-03-19 17:10:45

+1

可能的重複:http://stackoverflow.com/questions/2554839/select-css-based-on-multiple-class – vlcekmi3 2013-03-19 17:13:34

回答

3

CSS:

.negative.arrow { 
    /* Apply your CSS rules here */ 
} 

.positive.arrow { 
    /* Apply your CSS rules here */ 
} 
相關問題