CSS: Select elements that contain another selector

CSS4 comes with :has. E.g. h1:has(b) would select all <h1> tags that contain a <b> tag.

This is implemented in no browser but the jQuery query engine already supports it as a custom extension.

Henning Koch about 5 years ago
This website uses short-lived cookies to improve usability.
Accept or learn more