how do I select a div with class "A" but NOT with class "B"?
Posted
by MedicineMan
on Stack Overflow
See other posts from Stack Overflow
or by MedicineMan
Published on 2010-03-20T00:49:48Z
Indexed on
2010/03/22
1:01 UTC
Read the original article
Hit count: 413
I have some divs:
<div class="A">"Target"</div>
<div class="A B">"NotMyTarget"</div>
<div class="A C">"NotMyTarget"</div>
<div class="A D">"NotMyTarget"</div>
<div class="A E">"NotMyTarget"</div>
Is there a CSS selector that will get me the div containing Target
but not the divs containing NotMyTarget
?
Solution must work on IE7, IE8, Safari, Chrome, and Firefox
Edit: So far Nick is the closest. It's clumsy and I don't like the solution, but at least it works: .A { style that all divs will take } div.B { style that will override style .A }
© Stack Overflow or respective owner