Day 3 - Introduction to Tailwind CSS

Welcome to Tailwind CSS!

A utility-first CSS framework for rapidly building custom user interfaces.


1. What is Tailwind CSS?

Tailwind CSS is a utility-first CSS framework designed for rapidly building custom, modern user interfaces directly in your HTML markup.

Instead of writing CSS like this:

/* Your CSS file */
.my-button {
  background-color: #3b82f6;
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: bold;
}

You write Tailwind like this:

<button class="bg-blue-500 text-white py-2 px-4 rounded-lg font-bold">
  Click Me
</button>
Key Benefit: You never leave your HTML to style elements. Every visual decision is visible right on the element itself.

2. Why Use Tailwind CSS?

No Naming Headaches

Stop inventing class names like .wrapper-inner-container-2. Apply styles directly without writing custom CSS.

Responsive by Default

Use breakpoint prefixes (sm:, md:, lg:) to apply styles at specific screen widths.

Tiny Final CSS

Tailwind CLI purges unused classes at build time, producing a final CSS file that can be just a few kilobytes.

Fully Customizable

Design tokens (colors, spacing, fonts) are configured in a single file, making it easy to maintain a consistent design system.


3. Tailwind vs Bootstrap

Feature Bootstrap Tailwind CSS
Approach Component-based Utility-first
Pre-built components? Yes (.btn, .card, .navbar) No — you build from scratch
Design uniqueness Looks like Bootstrap Fully custom
CSS file size ~30KB (minified) ~5KB (with purging)
Learning curve Low (use component classes) Medium (memorize utilities)

4. The Utility-First Workflow

Each Tailwind class does exactly one thing. You combine them directly in HTML to build any design you can imagine:

class="bg-white rounded-xl shadow-lg p-6 max-w-sm"

Example Card

This card is built with 4 utility classes applied to a single div.

← Back to Index Next: Setup →