Should You Use Tailwind CSS? (2024)

Should You Use Tailwind CSS? (2)

TL;DR: Yes, you should, especially if you’re starting a project from scratch. Below, I’ve also listed some cases where Tailwind might not be for you.

Tailwind is a CSS framework that allows you to style components directly from your HTML (or JSX) file.

It does so by adding predetermined classes (e.g., bg-red for a red background) which are not only more compact than traditional inline styles but also avoid the specificity problems that come with them.

1. Increases development speed

This might sound silly at first, but the fact that you’re coding both structure (HTML) and styling (CSS) in the same file DOES drastically increase coding speed. Especially because you’re skipping the step of changing files and looking for the corresponding style inside your CSS one.

2. Eliminates the need of naming elements

Since we’re styling HTML tags directly, there’s no need to name them or use methodologies like BEM or OOCSS. Naming things is among the biggest hassles in development (along with defining a decent project folder structure), and Tailwind allows you to skip it, which also helps with the first benefit.

3. Reduces the chances of error in styling

Although it is highly customizable, the aim of using Tailwind is to work within its predetermined styles (e.g., font sizes, widths and margins). This is specially useful when working with a team of developers and specially with a design system. Everyone knows that guy who can never set the pixel margins right.

1. "Ugly" HTML files

One of the biggest counterarguments against Tailwind is that it leaves HTML files messy, since styles (which also include pseudo-classes, media queries, transitions, and animations) are all inserted in a single line. For example, for a simple navigation button with a hover effect, we have:

<a
className="text-md lg:text-lg font-serif hover:bg-yellow transition-colors font-bold px-2 py-1 lg:px-3 lg:pt-1.5 lg:pb-1 rounded"
href="/about"
>
About
</a>

In my experience, I've never reached a point where I've thought the "clutter" reached an unacceptable point, especially when using tools like the Prettier plugin that helps organize it. However, I can easily see how it can be reached in some projects.

2. Limits styling possibilities

One of Tailwind’s perks can also be its biggest drawbacks. Even though there are many ways to circumvent Tailwind’s limitations, sometimes they’re not enough. Some of the cases where I’ve found it lacking are:

  1. Styling adjacent elements (the traditional + selector in CSS)
  2. Styling parents based on child (the new-ish :has() CSS pseudo-class)
  3. Adding/removing styles depending on the component's (React) state

Keep in mind that I’ve found solutions for all these issues, but at the time of writing, they’re not as elegant as I would have hoped.

1. When working with a new project

It allows you the flexibility of making Tailwind fit your project's needs and, most importantly, adapt your project into Tailwind's limitations.

2. When working with a team of developers

By working with a more limited scope of styles, it reduces the chances of styling errors and increases development speed.

3. When working with a design system

Especially one built with Tailwind’s styles in mind and, even better, using tools like Figma that have integrations with Tailwind, allowing developers to copy and paste the classes directly from the design into code.

1. When refactoring a bigger, pre-existing project

Speaking from experience, trying to fit a big pre-existing project into Tailwind’s mold is quite an ordeal. There will be multiple cases where it might not allow you to refactor components with the same (or even close) styles, interactions, and animations without using multiple workarounds.

2. When the project requires a high level of customization

For example, a project done by an agency where visual impact is more important than UX and UI. In these cases, Tailwind might turn into a limiter instead of a facilitator.

Should You Use Tailwind CSS? (2024)
Top Articles
Practical Guide on Implementing 'aria-expanded' in Web Development
Raid Shadow Legends and the 4 Starter Champions
Virtual Roster Ameristar
Duna To Kerbin Transfer Window
Jordan Lewis Leaks
Why Do Two Porsche Bucket Seats Cost More Than An Entire Boxster And An Entire Cayenne Combined? - The Autopian
Snohomish County Craigslist General For Sale
Biggerlifestyles
Seething Storm
Todoroki Oc
Caroline G. Atkinson Intermediate School
Newgate Honda at Navan, Newgate, MH
Top Songs On Octane 2022
Belle delphine grip tape by New User (Design 568636)
665 N Halsted St Chicago Il 60654
Unc Healthchart
Blak Stellenanzeigen
Best Restaurants Ventnor
Studentvue Lake Havasu
Avidxchange Cashflow Manager Login
German American Bank Owenton Ky
2005 Chevy Colorado 3.5 Head Bolt Torque Specs
Southwest Tracker Live
Remote Icloud Quota Ui
craigslist sitemap for Ludington ± 9 mi
Comcast Business Downdetector
G-code Explained | List of Most Important G-code Commands
Steelweb Usw
Ben Leventhal Net Worth
Driving Directions To Target Near Me
Galluch's Menu
Company Search Subscription Service
Arre St Wv Srj
Shiny Flowers Belinda
Ts Massage Fort Lauderdale
Dresses Walmart
K Pocha - Korean Pub Aurora Reviews
Paige Turco: Filme, Serien und Biografie
Ups Locations Massachusetts
Sharkbrew
9News Anchors Hate Each Other
Ultimate Guide to Visiting Dungeness, UK
Lowe's Garden Fence Roll
R/Bayonetta
Busted Newspaper Zapata Tx
Craigslist Arlington Tx Pets
Lids Locker Room Vacaville Photos
Yosemite Sam Hood Ornament
Epower Raley's
Lauren Mayberry of CHVRCHES has a brand new solo career — and a sound all her own
Panama City News Herald Obituary
Latest Posts
Article information

Author: Rubie Ullrich

Last Updated:

Views: 5974

Rating: 4.1 / 5 (72 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Rubie Ullrich

Birthday: 1998-02-02

Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

Phone: +2202978377583

Job: Administration Engineer

Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.