CSS :has() Examples

If the src attribute of an image includes the word "black", change the background to white and foreground to black.

.asset:has(img[src*="black"]) {
  color: black;
  background: white;
}

Syntax Logo Yellow

Syntax Logo Black