pseudo-class
:first-of-type — CSS reference
Matches the first sibling of its element type, not the first element with a particular class.
Formal Syntax & Structure
css syntaxcss
:first-of-typeWorking 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:first-of-type { 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>