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
Different Types of Authentication
How many people have walked on the Moon?
[PDF] (punctuation mark - used as punctuation in symbol sentences) YELLOW Character 8485 Fragezeichen 8485 vraagteken 8485 vraagteken - Free Download PDF
Bofa Financial Center Near Me
57 Freeway Accident Today 2023
Gmchc Live Stream
Andrew Camarata Castle Google Maps
415-261-2242
J Amore Love Net Worth
Suspect may have staked out Trump's golf course for 12 hours before the apparent assassination attempt
Serenity Nail Salon Brentwood Tn
University of Kentucky · Uk Turfland Clinic Pharmacy · 2195 Harrodsburg Rd, Room T1636, Lexington, KY 40504-3504 · Pharmacy
The Creator Showtimes Near Baxter Avenue Theatres
Apple Store Near Me Make Appointment
Red Door Broadview
Aldi Weekly Ad Lake Elsinore
Omitome Kemono
Xm Cowboys Game
Round Yellow Adderall
Horry County Mugshots September 18th, 2024 - WFXB
Lms Ensign Login
Nycda Login
Jordan Starr Myvidster
Sales & Deals — My Nintendo Store - Nintendo Official Site
2009 Acura Tsx Serpentine Belt Diagram
Sunnyside Kaiser Pharmacy Hours
Senior Tax Analyst Vs Master Tax Advisor
Angie Varona - Everything You Wanted To Know (2022 Update) - Ned Hardy
Gobluecc Sports
Devotion Showtimes Near Maya Cinemas Delano
Consuming Dark Poe
Craigslist Red Wing Mn
Usps Scheduling Passport
Yesterday's Tractors - Port Townsend, WA - 71 Reviews - Auto Repair in Port Townsend, WA - Birdeye
12 Silent Manga Omnibus
Parent Portal Pat Med
Lucki White House Lyrics
Cbs Fantasy Mlb
1964 1 2 Mustang For Sale Craigslist
Kaiser Hesperia Laboratory Hours
Mendicants Shout Crossword Clue
Fleet Feet Sports Johnson City Tn
Vinyl record sales continue resurgence
Pokemon Reborn Gyms
Selling Sunset's Emma Hernan Reveals Truth Behind 'Affair With Married Man' Rumour
Victoria Medlin Cause Of Death
Welcome to SportsLine! - SportsLine.com
Sinfuldeeds Russian French
Iraqi Dinar Detectives
Janitronics Team Hub
Twoplustwo Forums
What Is Opm1 Treas 310 Deposit
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.