Advanced CSS | Understanding CSS pseudo class has( )

Опубликовано: 27 Февраль 2025
на канале: VirtualAddiction
264
7

The :has() selector is a relatively new addition to CSS and is used to select elements based on their descendants. The selector allows you to select an element that contains another element that matches a specified selector. The :has() selector is useful for selecting elements based on their relationship with other elements in the HTML structure.

Has() is especially exciting as we have long wished for a 'parent' selectors. Support is fairly good but not all browsers natively support this feature. In this video I'll introduce you to has(), show you how to use it, and provide you with fallback content for those browsers that don't yet support it.