MDN self-hosted library · e01.org

`:heading()` CSS pseudo-class

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

html
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
css
:heading(1, 3) {
  color: tomato;
}
:heading(2, 4) {
  color: slateblue;
}