1

I'd like to select tags whose class is content and are a general successor sibling of .header tags which have as descendant .pagename > a[href="https://www.reddit.com/r/all"]. However it doesn't seem possible to group as such:

(.header .pagename > a[href="https://www.reddit.com/r/all"]) ~ .content {}

What can I do?

Nils André
  • 91
  • 1
  • 8
  • Why are you trying to group? If you remove your parenthesis, it will do what you want. – disinfor May 26 '21 at 21:18
  • Sorry, I didn't ask my question properly. I rephrased it so that it makes sense. @disinfor – Nils André May 26 '21 at 21:23
  • You have issues with your markup that need fixing. You shouldn't need this kind of selector. – serraosays May 26 '21 at 21:26
  • 2
    I think you're looking for the [`:has()`](https://developer.mozilla.org/en-US/docs/Web/CSS/:has) selector, e.g. `.header:has(.pagename > a[href="https://www.reddit.com/r/all"]) ~ .conent`. Unfortunately this has basically [no browser support at all](https://caniuse.com/css-has), yet. – Olly Hodgson May 26 '21 at 21:26

0 Answers0