<ul>
<li>Lorem, ipsum.</li>
<li>Eum, consequuntur?</li>
<li>Dolores, necessitatibus.</li>
<li>Cupiditate, eveniet?</li>
<li>Deserunt, libero!</li>
<li>Perspiciatis, facere.</li>
<li>Dolor, minima.</li>
<li>Iste, sapiente.</li>
<li>Iusto, ratione?</li>
<li>Recusandae, autem.</li>
</ul>
body {
display: grid;
place-content: center;
margin: 0;
min-height: 100vh;
background-color: hsl(222, 99%, 18%);
font-family: sans-serif;
color: hsl(222, 99%, 90%);
}
ul {
list-style: none;
padding: 0;
}
li {
margin-bottom: 0.3rem;
padding: 0.5rem;
}
/* Select every 3th item in the list. */
li:nth-child(3n) {
background: hsl(222, 99%, 80%);
color: hsl(222, 99%, 18%);
}
/* Select every 4th item in the list. */
/* li:nth-child(4n) {
background: hsl(222, 99%, 80%);
color: hsl(222, 99%, 18%);
} */
/* Select every 3th item in the list with an offset of two from the top. */
/* li:nth-child(3n + 2) {
background: hsl(222, 99%, 80%);
color: hsl(222, 99%, 18%);
} */
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.