Beispiel zur Notiz „CSS-Pseudoklassen not(), is() und where()“

Die Nachfahren-Falle bei :not()

Links: body :not(table) a trifft auch den Link in der Tabelle (rot), weil td und tr „kein table“ sind. Rechts: body a:not(table a) lässt ihn wirklich aus (grün nur außerhalb).

Im Beispiel steht statt body ein Container, damit beide Varianten auf eine Seite passen.

Getestet in Chrome 155. Browserstand und Einordnung: siehe Notiz.

.falsch :not(table) a

Link im Absatz

Link in der Tabelle

.richtig a:not(table a)

Link im Absatz

Link in der Tabelle