title: :nth-child(even/odd) selector with class
body: <p>I'm trying to apply odd/even selectors to all elements in a list with the class parent.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li class="parent"&gt;green&lt;/li&gt;
      &lt;li class="parent"&gt;red&lt;/li&gt;
      &lt;li&gt;ho ho ho&lt;/li&gt;
      &lt;li class="parent"&gt;green&lt;/li&gt;
      &lt;li class="parent"&gt;red&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>.parent:nth-child(odd) {
      background-color: green;
  }
  
  .parent:nth-child(even) {
      background-color: red;
  }
  
  ul {
      width:100px;
      height: 100px;
      display: block;
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/E3JIu.png" alt="enter image description here"></p>
  
  <p><a href="http://jsfiddle.net/u3AFd/" rel="noreferrer">Link to jsFiddle</a></p>
  
  <p>But the colors are resetting. I want the list items to be the color of the text.</p>
  
  <p>Is there a way to do this?</p>