Style Odd and Event child elements

March 17, 2021 1 min read
<div class="container">
  <span>Stay</span>
  <span>home!</span>
  <span>Stay</span>
  <span>safe!</span>
</div>

<style>
  .container span:nth-child(odd) { color: teal; }
  .container span:nth-child(even) { color: yellowgreen; }
</style>