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
Consider gutter-specific column sizing #531
Comments
My gut reaction is to recommend using CSS Grid instead of Flexbox (if you can live without IE11) support, because this is so much cleaner/easier there. Here's an example of a Tailwind plugin that adds support for it: https://github.com/tailwindcss/plugin-examples#css-grid-utilities If you do have to use Flexbox, I would personally rather use the extra element than bake highly specific CSS selectors like Another option is to write your own grid component classes that work as you've outlined, so you would just use classes like |
Yes, Grid is perfect for this and as much as I don't hang with old browsers we're stuck supporting IE11 for a while longer unforunately. And grid-gap doesn't work in in IE11, which is the whole point of using Grid for this application. |
Yeah totally understand. So I can say with confidence we definitely won't add anything like So I would recommend living with the extra wrapper, or extending Tailwind with your own grid component classes. I would probably do that as a plugin since that would let you do a lot of the math programmatically instead of hard-coding it: |
Thanks for the quick reply/discussion Adam. Tailwind seems to be the type of framework/library I've been looking for so I'll probably migrate to it as things progress for me (and my WP themes/plugins). |
Just curious: why not use padding instead of margin for the flex items? e.g.
No special CSS needed. |
I need padding/background-color/border/etc on the element/column itself. No way to do that and have a gutter without an extra div wrap. |
Right OK, I didn't realize you wanted to avoid an extra div. Sorry, should've read more carefully. I can't wait for the negative margin hack to be obsolete. For me, it's one of the most annoying things in web design today. Thankfully the |
This would require a bit more code but would be very powerful IMO. I built my own (not nearly as powerful) flexbox/columns framework Flexington. The main reason I did so was to allow 2 levels of HTML and have flexbox columns with adjustable gutters.
All the other frameworks can do this (Tailwind/Bootstrap/Foundation/Bulma/etc) but only if there is an extra HTML wrap.
A rough example of the solution I found was to do this (attempting to use Tailwind classes so it's easier to understand for the followers here:
So, the default
-ml-2
class has negative margin of-.5 rem
and the defaultw-1/3
class has width of33.33333%
. Whenw-1/3
is nested in a wrap with-ml-2
it subtracts that spacing.Hopefully this makes sense.
The original Flexington version does it with
gutter-*
classes like this:Would love to hear thoughts on this approach and potential for something related in Tailwind. It's honestly the only thing holding me back from making a full switch.
The text was updated successfully, but these errors were encountered: