title: How to conditionally apply a CSS class?
body: <p>How is it possible to implement, using CSS only (the worst of cases using some JS) to do the following</p>
  <p>global.css (readonly)</p>
  <pre class="lang-css prettyprint-override"><code>.red { 
      color: red;
      /*tens of lines of additionnal css*/ 
  }
  </code></pre>
  <p>mystyle.css</p>
  <pre class="lang-css prettyprint-override"><code>div[error] {
      background: yellow; 
      apply .red;  //                          &lt;&lt; here
  }
  </code></pre>
  <p>P.S.
  The question is <strong>not</strong> about <code>SASS</code> or <code>LESS</code>.</p>