Here is a blog post outlining what can be done using :has https://webkit.org/blog/13096/css-has-pseudo-class/