Hacker News new | ask | show | jobs
by henrikeh 1404 days ago
The article gives a few examples where a pseudo-class fits better with how CSS normally works. For example, the selector matches the last item in the selector. With ‘<‘ it would match ‘parent’ in your case.

You can also match descendants of something with the :has() selector. It really is more than a “parent selector”

1 comments

Example of this:

div:has(b) a

which matches a link inside a div that also contains bold text. The important part is that 'b' and 'a' can be very different places in the hierachy, they don't need to be same like like a 'b + a' selector.