-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Mask example images look unaligned #2194
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
Comments
Hi, I would like to work on this. This should not be too hard. |
nguyencongphap
added a commit
to nguyencongphap/tailwindcss.com
that referenced
this issue
Apr 9, 2025
philipp-spiess
pushed a commit
that referenced
this issue
Apr 22, 2025
Fixes #2194 The math for the `top-[calc(25%-2px)]` classes were incorrect. The percentage should correspond to: ``` Where u is a spacing unit, `0.25em` L is the "mask-add/subtract/…" text's `line-height` = 0.75rem * ( 1 / 0.75 ) = 1rem = 4u M is the "mask-add/subtract/…" text's `mb-3` = 3u H is the masked images' height, `h-24` = 24u Then Total height, T = L + M + H = 4u + 3u + 24u = 31u Masked image top offset, Q = L + M = 4u + 3u = 7u As a percentage = Q ÷ T = 7u ÷ 31u × 100% ≈ 22.6% ``` Thus to line everything up, the top should be `top-[calc(700%/31-2px)]`. However, since the bottom of each grid element is aligned to the bottom of the images, I'd thought it'd be simpler to offset the guide elements' Y position based of the bottom. Thus, we'd only need to offset their border width `2px`, with `-bottom-[2px]`. | Before | After | | --- | --- | |  |  | Perhaps ideally we'd use a CSS variable to DRY all the `2px` border width offsets but that seemed out of scope of this PR.
Fixed now, thanks to you, @nguyencongphap and @wongjn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using the latest stable version of Google Chrome.
Link to the page: https://tailwindcss.com/docs/mask-composite#basic-example
Screenshot:
The text was updated successfully, but these errors were encountered: