How to select previous sibling
If you run this code, the
.last
button will increase its width when the .central
button gets :hover
, but the same thing wont happen to .first
, I guess because it's before .central
, how do I make this work?
4 Replies
you can't easily travel up the tree in css, only down. You can do this with :has but that doesn't have support yet in firefox
+ is the "next-sibling combinator", meaning it only selects
.first
if it's preceded by .center:hover
there is no previous sibling combinatoroh!
we live in exciting times!
facts!