Skip to content

Instantly share code, notes, and snippets.

@EdCharbeneau
Created August 17, 2014 18:41
Show Gist options
  • Select an option

  • Save EdCharbeneau/49f20f59bcc7aedf008f to your computer and use it in GitHub Desktop.

Select an option

Save EdCharbeneau/49f20f59bcc7aedf008f to your computer and use it in GitHub Desktop.
Select previous sibling CSS
.previous:has(+ .next) {}
@gemmadlou

gemmadlou commented Oct 16, 2017

Copy link
Copy Markdown

Is this legitimate css? It would be awesome if it was

Update:
I've tried this. :( It'd be awesome if it became part of the css spec.

@igbanam

igbanam commented Nov 13, 2017

Copy link
Copy Markdown

When you tried this, did it work @gemmadlou?

@tomillo

tomillo commented Jun 7, 2018

Copy link
Copy Markdown

It didn't work for me

@alocin

alocin commented Jun 11, 2018

Copy link
Copy Markdown

From what I know :has() is not supported by most of the browsers by now.

@dalecreativ

Copy link
Copy Markdown

https://caniuse.com/#feat=css-has
It is a working draft. We'll get it eventually.

What would be more useful is previous sibling selector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment