title: Alternate table row color using CSS?
body: <p>I am using a table with alternate row color with this.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>tr.d0 td {
    background-color: #CC9999;
    color: black;
  }
  tr.d1 td {
    background-color: #9999CC;
    color: black;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table&gt;
    &lt;tr class="d0"&gt;
      &lt;td&gt;One&lt;/td&gt;
      &lt;td&gt;one&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr class="d1"&gt;
      &lt;td&gt;Two&lt;/td&gt;
      &lt;td&gt;two&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here I am using class for <code>tr</code>, but I want to use only for <code>table</code>. When I use class for table than this apply on <code>tr</code> alternative.</p>
  
  <p>Can I write my HTML like this using CSS?</p>
  
  <pre><code>&lt;table class="alternate_color"&gt;
      &lt;tr&gt;&lt;td&gt;One&lt;/td&gt;&lt;td&gt;one&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt;Two&lt;/td&gt;&lt;td&gt;two&lt;/td&gt;&lt;/tr&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p>How can I make the rows have "zebra stripes" using CSS?</p>