Blog › CSS · Published 2026-11-26

Is there a CSS parent selector? Yes: :has()

Modern CSS has :has():

a:has(img) { border: 1px solid; }

This selects links that contain an image. Check the browser compatibility table on MDN before depending on it for older browsers.

Official sources

Need help with your project?
We build websites, systems and automation. Start your project WhatsApp

All articles