Unsolicited tip #1 for Tailwind CSS users

Michael Andreuzza - Sep 30 '23 - - Dev Community

I keep seeing this way of using Tailwind:

This doe's not allow you to be productive because you are adding extra divs and classes and it becomes super uncluttered and takes you longer to write.

Don't forget that this is Tailwind, lot's of classes, right?

  1. We could also remove the "mt-", "mb-" and "space-" and simply using "gap-".
  2. We could also remove the "px-8" and lift it up on the first div together with "py-12 max-w-7xl mx-auto" and wrap it all with a tag.

It's supported in every browser.......

snippet one

Keep it clean, tidy and semantic.

snippet two

Hope you find it helpful.

/mike (x.com/mike_andreuzza

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .