Majid Fouladpour Majid Fouladpour - 1 year ago 76
CSS Question

CSS rule to apply only if element has BOTH classes

Let's say we have this markup:

<div class="abc"> ... </div>
<div class="xyz"> ... </div>
<div class="abc xyz" style="width: 100px"> ... </div>

Is there a way to select only the
which has BOTH
classes (the last one) AND override its inline width to make the effective width be 200px?

Something like this:

[selector] {
width: 200px !important;

Answer Source {
    /* rules go here */

... or simply: {
    /* rules go here */