pseudo-class
:nth-child() — CSS reference
Counts element siblings from one. The optional of list restricts the counted set; placing a class outside the function does not filter the count.
Formal Syntax & Structure
css syntaxcss
:nth-child(An+B [of selector-list]?)Working Example
Example Snippetcss
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Selector lab</title><style>:where(.sample) { color: rgb(32, 32, 32); }p:nth-child(3) { color: rgb(0, 96, 80); }</style></head><body><div><p id="a" class="sample">A</p><span>Spacer</span><p id="b" class="sample">B</p></div></body></html>