pseudo-class

:heading() — CSS reference

Draft functional heading selector filters headings by level. An explicit h2 selector is a simple fallback for level two in HTML. The local engine rejects this syntax; the base styling remains available.

Formal Syntax & Structure

css syntaxcss
:heading(2) { color: blue; }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>:heading()</title><style>body{margin:8px;background:white;color:black;font:16px/20px sans-serif}*{box-sizing:content-box}h2{color:green}:heading(2){color:blue}</style><body><h2 id="a">Section</h2></body></html>
CSS Reference