CSS nth-child Playground

A tool to help you build, test and explore CSS nth-child selectors.

Selects every odd-indexed item. Pretty simple really.

Quick Rules

Use the presets below to quickly apply rules for selecting every nth item, first/last items, and more complex patterns.

Every nth item

First/last

Complex rules

Variables

Tweak the variables to suit your specific needs, or explore how the nth-child rule changes with different inputs.

Count from:

:nth-child

:nth-last-child

Every:

Select every nth item

Range: from 0th to 20th

Select range of items to target

Preview

Items:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20