title: CSS selector for an element having class .a and class .b
body: <p>I need to style an element that has both class <code>.a</code> and class <code>.b</code>. How do I do it?</p>
  
  <p>The order the classes appear in the HTML might vary.</p>
  
  <pre><code>&lt;style&gt;
      div.a ? div.b {
          color:#f00;
      }
  &lt;/style&gt;
  &lt;div class="a"&gt;text not red&lt;/div&gt;
  &lt;div class="b"&gt;text not red&lt;/div&gt;
  &lt;div class="a b"&gt;red text&lt;/div&gt;
  &lt;div class="b a"&gt;red text&lt;/div&gt;
  </code></pre>