pseudo-class
:last-child — CSS reference
Matches the final element sibling. It need not be the last text node.
Formal Syntax & Structure
css syntaxcss
:last-childWorking 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:last-child { 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>