Jim Nielsen set out to style a bunch of links that appeared before hr
elements. As the element tree – generated from a Markdown file – was entirely flat, there are no enclosing section
elements to hook onto in order to select those links (using something like section p:last-child a:only-child
).
The solution? The :has()
selector:
p:has(+ hr) a:only-child {
}
This, again, proves that the :has()
selector is way more than just a parent selector.