I’ve been using (descendent combinator) and >(child combinator) heavily, bud did not pay much attention to ~ (general sibling combinator) and + (adjacent sibling combinator).
Today I was making the homepage for TripTime, and I wanted to add a nice dotted gray divider between components:

border preview

The Next.js code looks like this:

react code

This time instead of messing with nth-child pseudo class, I used the adjacent sibling combinator to get a quick solution in choosing all .component elements but the last one, and it is as simple as this:

1
2
3
.component + .component {
border-top: 1px dotted var(--box-shadow-color);
}

This is telling CSS to select all .component elements that are immediately after a .component element (and share the same parent).