6.5 Advanced
Parent selector
The CSS tools seen so far allow us to perform a descendant selection based on properties of ancestors, not the other way around.
The
:has()
pseudo-class allows us to perform an ancestor selection based on properties of its descendants.The
:has()
pseudo-class was added in the year 2022 to most modern browsers.Such recent new feature introduces many posibilities for web design.
Examples: