nth-of-type

by brantolsen

HTML

<ul>
    <li>
<span>Test 1</span>
    </li>
    <li>
<span> 2 Test</span>
    </li>
</ul>

<br>
Should look like this:
<br>
<span class="selected">Test 1</span>
<br>
<span class="selected"> 2 Test</span>

CSS

span:nth-of-type(even) {
  background-color: grey;
}

span:nth-of-type(odd) {
  background-color: blue;
}