-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Feature request: Add support for using px instead of rem's #800
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
I read the article. It's a good article, but I wasn't talking about accessibility / user preferences when I said that
That wouldn't work if everything was in |
Ok, that's fine, so what I propose is to make it optional. |
What benefit would you get if we defined everything in pixels? `p-4` would
still be 16px by default like it is already, so I can’t quite figure out
what the improvement would be. Is it because you are measuring things in a
designer-provided mock-up and trying to find the matching value in Tailwind
or something?
Rem is definitely better for the reason Ben stated and comes with no
downside as far as I’ve seen. Would simply including the pixel conversions
in the docs be all you actually need?
…On Fri, Mar 22, 2019 at 5:30 PM Andreas Heintze ***@***.***> wrote:
Ok, that's fine, so what I propose is to make it optional.
./node_modules/.bin/tailwind init [filename] --unit-px
..or something like that.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#800 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEH3bDg2H0Pfa3vWhLevsJvLOghdFb70ks5vZUtYgaJpZM4cEa-n>
.
|
You are right, there's no benefit in supporting switching to px in the creation of tailwind.js. As long as we avoid using rem and em in media queries and if we want control over it, we can just override the browsers default font-size by setting it in px on html element. So just forget my proposal. :) |
While I wouldn't subscribe to the idea of changing the system to px over rem, I believe there is an argument to be made for a pixel utility for occasions when you need the fine grained control that pixel level adjustments give you. The best thing about tailwind is its ability to add more fine grained control over elements in a simply way, ie: not having to write your own classes. And while I absolutely love tailwind, and I mean LOVE ... I find there are times when it's seems a bit opinionated and forces the user to break out of the tool to solve a given issue. Let me give an example that I gave on Twitter. I have a button with In my case I was forced to eliminate the bottom padding from the class tag and use a style tag on the element to set it to But would it not fit the tailwind ideology to have this functionality baked in as a utility? I would propose a simple utility for any elements that use rem measurements currently that allows the user to call a pixel based measurement on a given element when it's needed. I know this is possible because we have the For instance given my previous example:
Where x would tell tailwind to use the number that follows and pixels for Obviously it wouldn't need to be an Not something that would be used all the time, but I think it would be a useful utility to add to make the tool more complete and flexible. |
I'm just getting started with tailwind, and I already love it. You guys rock. In building my first 3 components from pixel-perfect wireframes, I have also encountered similar scenarios to what @19peaches described above. To use values in pixels that aren't multiples of 4, I've extended the theme, like:
I can then use classes like But this just feels wrong and I'm trying to avoid defining custom classes in my components if possible. I too would be excited to use an option that outputs classes explicitly using pixels as units, something like described above. I would even be willing to help build and/or test the feature. |
I am leaving adjustment suggestion here because this "issue" is most relevant |
Using There is no way to reset the |
I would like to add my support for an optional flag to generate tailwind with pixel, although i usually would defer to using rem recently i've been doing allot of work where i'm building embeddable components using Tailwind. To insulate the component from being impacted by a rogue root font size having the option to generate Tailwind output with pixels rather than rem would be very helpful. |
Here's a snippet from a
This will change most classes to use |
Isn't it surprising that changing your font size in the browser setting also changes the padding? If a user changes the font size, I would figure they wouldn't expect spacing and other dimensions to change. Usually people use the browser zoom to change the CSS reference pixel. Doing everything in rem means zooming + changing browser font size does the same thing, which feels redundant. If everything is in REM, the user has no way to increase the font size without also zooming everything else. |
Can you please replace the rem's with px instead?
https://mindtheshift.wordpress.com/2015/04/02/r-i-p-rem-viva-css-reference-pixel/
Or at least make it an option when creating tailwind.js.
The text was updated successfully, but these errors were encountered: