selettore ogni 3 elementi

by Andrea Biagi

HTML

<ul>
<li>primo</li>
<li>secondo</li>
<li>terzo</li>
<li>quarto</li>
<li>quinto</li>
<li>sesto</li>
<li>settimo</li>
<li>ottavo</li>
<li>nono</li>
<li>10</li>
<li>11</li>
<li>12</li>
<li>13</li>
</ul>

CSS

ul li:nth-child(odd){
  color: yellow;
}
	
ul li:nth-child(even){

color: red;
}
	



@media screen and (min-width: 500px){
  
ul li:nth-child(3n+1){
  color: yellow;
}
	
ul li:nth-child(3n+2){

color: red;
}
	
ul li:nth-child(3n+3){
  color: blue;
}

}