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

Using 0 as arbitrary value doesn't work for for some properties #6227

Closed
arzatskis opened this issue Dec 1, 2021 · 5 comments
Closed

Using 0 as arbitrary value doesn't work for for some properties #6227

arzatskis opened this issue Dec 1, 2021 · 5 comments

Comments

@arzatskis
Copy link

What version of Tailwind CSS are you using?

v2.2.19

Reproduction URL

https://play.tailwindcss.com/eOQOc2klvH

Describe your issue

Trying to apply custom value as 0 for border width Tailwind JIT doesn't generate the selector. E.g. using border-[0] does nothing, even though border-width: 0 is valid CSS expression. Same for font size with text-[0] (font-size: 0 is valid CSS). Haven't checked other properties.

This doesn't happen and when applying w-[0] - selector / style is applied as expected.

Screen Shot 2021-12-01 at 11 44 19

@AviAvinav
Copy link
Contributor

I checked this out, it seems it is working when you use text-[0px] or border-[0px], it seems to need a unit. Hope it helps for now.

@arzatskis
Copy link
Author

Yeah, I figured out, that it works with units set / as workaround. Probably this still should work / be consistent with other properties (e.g. w-[0] / h-[0]) and work with just 0?

@AviAvinav
Copy link
Contributor

Yeah, it seems that setting the unit works with all utilities but just "0" works with only some.

@adamwathan
Copy link
Member

Think we can probably support this, should just be a matter of adding a check for 0 here:

https://github.com/tailwindlabs/tailwindcss/blob/master/src/util/dataTypes.js#L80-L85

Happy to take a look at a PR if someone wants to give it a shot and add some tests 👍🏻

@RobinMalfait
Copy link
Contributor

Hey! Thank you for your bug report!
Much appreciated! 🙏

This should be fixed, and will be available in Tailwind v3.

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

4 participants