mercredi 15 juin 2016

CSS odd and even puts same color side by side

I do not want that the same color is side by side. At the moment: 1-2-1-1-2 but It must be: 1-2-1-2-1

HTML

<ul class="list list-unstyled">
  <li>The_hangover_part_1.avi<span class="pull-right">25Gb</span></li>
  <li>The_hangover_part_1_intro.avi<span class="pull-right">15Gb</span></li>
  <li>Covers<span class="pull-right">255Kb</span></li>
  <ul>
    <li>the_hangover_part_1_cover_1.jpg<span class="pull-right">123Kb</span></li>
    <li>the_hangover_part_1_cover_2.jpg<span class="pull-right">122Kb</span></li>
    <li>the_hangover_part_1_cover_2.jpg<span class="pull-right">122Kb</span></li>
  </ul>
</ul>

CSS

.list li:nth-child(even) {
  background: transparent;
}
.list li:nth-child(odd) {
  background-color: rgba(255,255,255,0.05);
}

Aucun commentaire:

Enregistrer un commentaire