Skip to content

[v4] divide-* class produces extra border on hidden last child element #17086

Closed Answered by wongjn
mkfizi asked this question in Help
Discussion options

You must be logged in to vote

This is a side-effect of a breaking change. The docs talk about Space-between but this does apply the same to divide-* too:

Space-between selector

We've changed the selector used by the space-x-* and space-y-* utilities to address serious performance issues on large pages:

/* Before */
.space-y-4 > :not([hidden]) ~ :not([hidden]) {
  margin-top: 1rem;
}
/* Now */
.space-y-4 > :not(:last-child) {
  margin-bottom: 1rem;
}

So in your example in v3, all but the first element gets border-top. In v4, all but the last element gets border-bottom.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by mkfizi
Comment options

You must be logged in to vote
2 replies
@wongjn
Comment options

wongjn Mar 9, 2025
Collaborator

@mkfizi
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #17078 on March 09, 2025 10:47.