The Power of :has() in CSS | CSS-Tricks
Briefly

The :has() CSS pseudo-class helps style an element if any of the things we're searching for inside it are found and accounted for.
"The functional :has() CSS pseudo-class represents an element if any of the relative selectors that are passed as an argument match at least one element when anchored against this element.
In years past we had no way of styling a parent element based on a direct child of that parent with CSS or an element based on another element.
If that h2 is present, important, and directly after the h1, you might want to make that h1 stand out. Before you would have had to write a JS function.
Read at CSS-Tricks
[
add
]
[
|
|
]