title: CSS all classes starts with and ignore some child class
body: <p>I have a nested HTML element structure where I need to apply css styles for some condition.</p>
  
  <ol>
  <li>Apply styles to class starts with "a-" in the <code>.a-comp</code> element</li>
  <li>Ignore styles to <code>.a-col</code> class and its child elements which have "a-*" class </li>
  </ol>
  
  <p>The code below works for the above scenario. But it doesn't work for other child elements which have "a-*" class.</p>
  
  <p>How can I achieve that?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.a-comp :not(.a-col) [class^="a-"],
  .a-comp :not(.a-col) [class*="a-"] {
    color: red;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="a-comp"&gt;
    &lt;div class="a-one"&gt;
      &lt;div class="a-col"&gt;
        &lt;div class="a-text"&gt;
          Text1
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="a-row"&gt;
      &lt;div class="a-text"&gt;
        Text 2
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://jsfiddle.net/7sjfoeLq/4/" rel="nofollow noreferrer">View on JSFiddle</a></p>