CSS :nth-child() Generator
Build :nth-child, :nth-of-type, and An+B formulas with a live matching grid. Copy CSS selectors in your browser. Free and private.
Loading tool...
What is CSS :nth-child() Generator?
The CSS :nth-child() Generator is a free browser tool that builds An+B selectors and shows which siblings match on a live grid.
Key Benefits
- Confirm zebra, every-nth, and first-n patterns before editing CSS
- Compare child versus of-type counting on the same list
- Preview Selectors Level 4 of() filtering
- Copy a ready CSS rule without leaving the page
Common Use Cases
- β’Styling alternating table rows or list items
- β’Highlighting the first three cards in a grid
- β’Selecting every third product tile
- β’Learning An+B notation with instant visual feedback
How to Use the CSS :nth-child() Generator
- Choose a formula: Pick a preset such as odd or first 3, or type an An+B formula like 3n+1.
- Pick a pseudo-class: Select :nth-child, :nth-of-type, or a last-child variant depending on how you want siblings counted.
- Check the grid: Watch the live preview highlight matching items and adjust the item count if needed.
- Copy the CSS: Set a base selector and declarations, then copy the generated rule into your stylesheet.
Key Features
- An+B parser for odd, even, integers, and formulas like 3n+1
- Live numbered grid showing which siblings match
- :nth-child, :nth-of-type, :nth-last-child, and :nth-last-of-type
- Optional Selectors Level 4 of() filter
- Copy a complete CSS rule with custom declarations