Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current styling for space-x-n and space-y-n creates alignment-breaking whitespaces before all elements aside the first when wrapped from page shrink #1836

Open
ogbotemi-2000 opened this issue Jun 26, 2024 · 0 comments

Comments

@ogbotemi-2000
Copy link

Screenshots describing this issue

  • On mobile
    mobile-issue
    The elements wrapped in the shrunken view port, from the second to the last, all have a left margin that breaks their alignment with the first
  • On desktop
    desktop-issue
    This design inconsistency is not perceptible if the elements are not wrapped due to overflow as displayed in larger view ports

The source of this behavior

The margin-left property in the style block below is responsible

.space-x-6>:not([hidden])~:not([hidden]) {
    --tw-space-x-reverse: 0;
    margin-right: calc(1.5rem* var(--tw-space-x-reverse));
    margin-left: calc(1.5rem* calc(1 - var(--tw-space-x-reverse)));
}

A likely solution

As hinted in the screenshots above, removing the margin-left property and making the margin-right property equal twice its original value will result in the stylesheet below

.space-x-6>:not([hidden])~:not([hidden]) {
    --tw-space-x-reverse: 0;
    margin-right: calc(calc(1.5rem * 2) * var(--tw-space-x-reverse)) /*may also be hardcoded as calc(3rem * var(--tw-space-x-reverse))*/;
/*    margin-left: calc(1.5rem* calc(1 - var(--tw-space-x-reverse))); */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant