Opposite of adjacent sibling combinator?

Title ^
12 Replies
son arg
son argOPβ€’3y 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β€’3y ago
Message Not Public
Sign In & Join Server To View
13eck
13eckβ€’3y 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β€’3y ago
(among other uses of :has())
son arg
son argOPβ€’3y ago
Thanks guys! @13eck @Julio_ πŸ™
MarkBoots
MarkBootsβ€’3y 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β€’3y ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
son arg
son argOPβ€’3y ago
I was gonna ask, could you explain that selector in words but @Julio_ worded it nicely
son arg
son argOPβ€’3y ago
So this is the starting point where we say "except"?
Unknown User
Unknown Userβ€’3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server