Browser Support for the :has() Pseudo-Class
The :has() pseudo-class is powerful but its browser support varies. Modern browsers have started supporting it, but older browsers and some versions may not recognize it yet.
Fully supported in the latest versions of Chrome, Edge, Safari, and Opera.
Firefox started supporting it experimentally in newer versions, but it may require enabling a flag or be limited in some releases.
Internet Explorer and very old browser versions do not support :has().
Always test critical use cases and provide fallbacks or progressive enhancement for unsupported browsers.
Because :has() can affect styling dynamically based on child elements, you may want to use feature queries (@supports) or fallback styles to ensure a good user experience in browsers that do not support it.
Check browser compatibility before using :has() in production projects.
Use feature queries (@supports) to apply styles only when supported.
Consider progressive enhancement so that the UI works even without :has().
Test on multiple browsers to ensure consistent appearance and functionality.
You're building a card component that highlights parent containers when a button inside is hovered — you used :has() but it doesn't work in Chrome. What do you check first?
Your teammate says :has() works fine in their browser, but your design breaks. What’s the most likely reason, and how would you verify it?
A user reports that the 'selected' state on a navigation menu isn't showing up on their iPhone — you used :has() to style the parent based on child state. How do you debug this?
You're implementing a dynamic form validation UI using :has() to style parent fields when inputs are invalid. QA finds it doesn't work on Android Chrome 90. What’s your plan to fix it without rewriting the entire component?
You’re designing a reusable component library that uses :has() for advanced parent-child styling. How do you balance modern CSS elegance with supporting legacy enterprise clients on outdated browsers?
Your team wants to adopt :has() to reduce JavaScript-driven DOM manipulation for hover states. What performance, maintenance, and compatibility tradeoffs would you evaluate before committing?
Your company’s flagship product still supports IE11 and iOS 13, but engineering wants to migrate to :has() for cleaner CSS. How do you structure a phased migration plan that minimizes user impact and technical debt?
You’re leading a cross-team initiative to standardize CSS architecture. How do you advocate for or against adopting :has() given its inconsistent browser support, and what metrics would you use to justify the decision?