:nth-child(odd) stripes rows; :nth-child(3n) hits every third item; :nth-child(2) the second. :nth-of-type() counts only same-tag siblings. There's also :first-child, :last-child, :only-child for the common cases.
:nth-child(odd) stripes rows; :nth-child(3n) hits every third item; :nth-child(2) the second. :nth-of-type() counts only same-tag siblings. There's also :first-child, :last-child, :only-child for the common cases.
<!doctype html><html><head><meta charset="utf-8">
<style>li{list-style:none;padding:6px;color:#e6e0ff}li:nth-child(even){background:#140a28}li:nth-child(3n){color:#b388ff}</style></head><body style="background:#06040d;padding:20px"><ul><li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li></ul></body></html>▶ Open the interactive comic issue