Opposite of adjacent sibling combinator?

Title ^
12 Replies
rezabet
rezabetβ€’2y ago
So instead of immediately follows, is there immediately before? --- Reference: https://developer.mozilla.org/en-US/docs/Web/CSS/Adjacent_sibling_combinator
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
13eck
13eckβ€’2y ago
Kevin recently did a video on this: https://youtu.be/OGJvhpoE8b4
Kevin Powell
YouTube
I never thought this would be possible with CSS
The :has() pseudo-class is here, and while it’s often called the parent selector, it can actually do a lot more than that! πŸ”— Links βœ… Example One: https://codepen.io/kevinpowell/pen/jOxrjvW βœ… Example Two: https://codepen.io/kevinpowell/pen/dyeXxJx βœ… Example Three: https://codepen.io/kevinpowell/pen/ZEopzpP βœ… Example Four: https://codepen.io...
13eck
13eckβ€’2y ago
(among other uses of :has())
rezabet
rezabetβ€’2y ago
Thanks guys! @13eck @Julio_ πŸ™
MarkBoots
MarkBootsβ€’2y ago
indeed, the :has() pseudo-selector will do it. just for funzies, there is a way to get ALL siblings before (not your question, i know)
/* all siblings before target*/
.parent > :not(.target, .target~*) { color: red }
/* all siblings before target*/
.parent > :not(.target, .target~*) { color: red }
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
rezabet
rezabetβ€’2y ago
I was gonna ask, could you explain that selector in words but @Julio_ worded it nicely
rezabet
rezabetβ€’2y ago
So this is the starting point where we say "except"?
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View