ABOUT

MENU

Tailwind Tips I Wish I Knew Earlier

Interfaces

9/27/25

INTRODUCTION

Tailwind CSS has completely changed how I style UIs. But like many, I initially felt overwhelmed by long class strings and repetition. Over time, I picked up tricks that make Tailwind cleaner and faster.

Here are the tips I wish I had known earlier.

1. USE @apply FOR REPEATED STYLES

Instead of copying the same 10 classes everywhere, create utility classes.

css

/* styles.css */
.btn {
  @apply px-4 py-2 rounded-md font-semibold shadow hover:shadow-lg transition;
}

Now:

html

<button class="btn bg-blue-500 text-white">Save</button>

2. USE VARIANTS FOR HOVER, FOCUS, DARK MODE

Tailwind shines with states. You can add hover/focus/dark styles inline.

html

<input 
  class="border p-2 focus:outline-none focus:ring-2 focus:ring-blue-400 dark:bg-gray-800"

3. RESPONSIVE DESIGN MADE EASY

Use Tailwind’s breakpoints to write clean, mobile-first styles.

html

<div class="text-sm md:text-base lg:text-lg">
  Responsive text size
</div>

4. LEVERAGE prose FOR CONTENT

Tailwind Typography plugin gives you beautiful defaults for articles and blogs.

html

<article class="prose lg:prose-xl">
  <h1>Hello World</h1>
  <p>This is styled automatically.</p>
</article>

5. EXTRACT CONFIG FOR CONSISTENCY

Put colors, spacing, and fonts in tailwind.config.js so you don’t repeat magic numbers.

JS

theme: {
  extend: {
    colors: {
      brand: '#4f46e5'
    }
  }
}

CONCLUSION

Tailwind becomes a joy to use once you learn these patterns: @apply, state variants, responsive utilities, typography, and configs. Adopt them early, and your Tailwind projects will feel scalable and maintainable.


INTRODUCTION

Tailwind CSS has completely changed how I style UIs. But like many, I initially felt overwhelmed by long class strings and repetition. Over time, I picked up tricks that make Tailwind cleaner and faster.

Here are the tips I wish I had known earlier.

1. USE @apply FOR REPEATED STYLES

Instead of copying the same 10 classes everywhere, create utility classes.

css

/* styles.css */
.btn {
  @apply px-4 py-2 rounded-md font-semibold shadow hover:shadow-lg transition;
}

Now:

html

<button class="btn bg-blue-500 text-white">Save</button>

2. USE VARIANTS FOR HOVER, FOCUS, DARK MODE

Tailwind shines with states. You can add hover/focus/dark styles inline.

html

<input 
  class="border p-2 focus:outline-none focus:ring-2 focus:ring-blue-400 dark:bg-gray-800"

3. RESPONSIVE DESIGN MADE EASY

Use Tailwind’s breakpoints to write clean, mobile-first styles.

html

<div class="text-sm md:text-base lg:text-lg">
  Responsive text size
</div>

4. LEVERAGE prose FOR CONTENT

Tailwind Typography plugin gives you beautiful defaults for articles and blogs.

html

<article class="prose lg:prose-xl">
  <h1>Hello World</h1>
  <p>This is styled automatically.</p>
</article>

5. EXTRACT CONFIG FOR CONSISTENCY

Put colors, spacing, and fonts in tailwind.config.js so you don’t repeat magic numbers.

JS

theme: {
  extend: {
    colors: {
      brand: '#4f46e5'
    }
  }
}

CONCLUSION

Tailwind becomes a joy to use once you learn these patterns: @apply, state variants, responsive utilities, typography, and configs. Adopt them early, and your Tailwind projects will feel scalable and maintainable.


Create a free website with Framer, the website builder loved by startups, designers and agencies.