Learn Tailwind CSS โœจ

A friendly, beginner-first tutorial blog designed to help you feel confident, creative, and powerful while learning CSS โ€” no intimidation, no gatekeeping.

๐Ÿ’ก Think of Tailwind like fashion: instead of writing long CSS files, you pick ready-made styles (classes) and layer them like outfits.

๐ŸŽจ Colors - Your Design Palette

Colors in Tailwind are like choosing paint for your room. You can use them for backgrounds, text, borders, and more!

๐ŸŽจ Color Palette Reference

๐Ÿ“Œ Important: Use only the colors shown below in the examples!

Barbie
#FF69B4
Blush
#FFB6C1
Sky
#00BFFF
Pink-500
Purple-400
Blue-400
Green-400
Yellow-300

๐Ÿ’ก Tailwind has colors from 50 (lightest) to 950 (darkest). Try pink-100, pink-300, pink-700!

Background Colors

Use bg- prefix for backgrounds. Try changing the color below using colors from the palette above!

Change bg-barbie to bg-sky, bg-blush, bg-pink-500, bg-purple-400, bg-blue-400, bg-green-400, or bg-yellow-300

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

Pretty Pink Box ๐Ÿ’–

Text Colors

Use text- prefix for text colors. Use colors from the palette above!

Try text-sky, text-purple-400, text-blue-400, text-green-400, or text-yellow-300

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

Hello Beautiful!

๐Ÿ”˜ Buttons - Make Things Clickable

Buttons are everywhere! Learn to style them beautifully with Tailwind.

Basic Button

Start with colors, padding, and rounded corners.

Try changing px-6 (horizontal padding) or py-3 (vertical padding)

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

Rounded Buttons

Use rounded-full for pill-shaped buttons!

Try rounded-lg, rounded-xl, rounded-2xl, or rounded-full

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

Button with Hover Effects

Add hover: for interactive effects!

Try hover:scale-110, hover:shadow-xl, or hover:rotate-2

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

Button Examples

๐Ÿ–ผ๏ธ Images - Shape Your Visuals

Make images look amazing with rounded corners, circles, and perfect sizing!

Rounded Images

Use rounded- for soft corners on your images.

๐Ÿ“Œ Note: The images below are examples only and are not editable. They demonstrate how Tailwind classes affect image styling.

Rounded example
<img src="your-image.png" alt="Description" class="w-48 h-48 rounded-lg">

๐Ÿ’ก Try rounded-md, rounded-lg, rounded-xl, rounded-2xl, or rounded-full for circles!

Circular Images

Perfect circles with rounded-full! Great for profile pictures.

Circular example
<img src="profile.png" alt="Profile picture" class="w-32 h-32 rounded-full">

๐Ÿ’ก Make sure width and height are the same for perfect circles!

Image Sizes

Control size with w- and h- classes.

SmallMediumLarge
<img src="image.png" alt="Description" class="w-24 h-24 rounded-xl">

๐Ÿ’ก Try w-16 h-16 (small), w-40 h-40 (medium), or w-48 h-48 (large)

Image Examples

Here are examples of different image styles you can create with Tailwind:

Rounded

rounded-lg

Circular

rounded-full

Square

rounded-xl

Box

with border

๐Ÿ’ก These images are examples only. Replace the placeholder URLs with your own PNG images!

โœ๏ธ Typography - Beautiful Text

Make your text stand out with different sizes, weights, and styles!

Text Sizes

Use text- with sizes from xs to 9xl.

Try text-sm, text-base, text-lg, text-xl, text-2xl, text-3xl, text-4xl, or text-5xl

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

Big Bold Text

Font Weights

Control how bold your text is with font- classes.

Try font-thin, font-light, font-normal, font-medium, font-semibold, font-bold, or font-extrabold

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

Bold Text

Text Alignment

Align text left, center, or right!

Try text-left, text-center, or text-right. Note: text alignment works on block elements!

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

Centered Text

Typography Examples

Heading 1 - Extra Bold

Heading 2 - Bold

Heading 3 - Semi Bold

Regular paragraph text

Small italic text

๐Ÿ“ฆ Flexbox - Arrange Items

Flexbox is like organizing items in a row or column. Perfect for navigation bars, cards, and layouts!

Horizontal Layout (Row)

Use flex to arrange items side by side.

Try adding justify-center, justify-between, or items-center

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

Item 1
Item 2
Item 3

Vertical Layout (Column)

Use flex flex-col to stack items vertically.

Try adding items-center or items-end for alignment

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

Top
Middle
Bottom

Centering Content

Perfect for centering items both horizontally and vertically!

items-center = vertical, justify-center = horizontal

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

Centered!

Flexbox Properties

justify- (horizontal)
  • โ€ข justify-start (left)
  • โ€ข justify-center (center)
  • โ€ข justify-end (right)
  • โ€ข justify-between (space between)
items- (vertical)
  • โ€ข items-start (top)
  • โ€ข items-center (middle)
  • โ€ข items-end (bottom)
  • โ€ข items-stretch (fill)

๐Ÿ”ฒ Grid - Perfect Layouts

Grid is like a table or spreadsheet - perfect for card layouts, galleries, and organized content!

Basic Grid

Use grid grid-cols- to create columns.

Try grid-cols-2, grid-cols-4, or grid-cols-5

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

1
2
3

Responsive Grid

Make grids that adapt to screen size with md: or lg:!

1 column on mobile, 2 on tablet, 3 on desktop!

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

Card 1
Card 2
Card 3

Grid Gap

Control spacing between grid items with gap-.

Try gap-2 (small), gap-4 (medium), gap-8 (large), or gap-12 (extra large)

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

A
B
C

Grid Examples

1
2
3
4

๐Ÿ’ก Grid is perfect for card layouts, image galleries, and dashboard designs!

๐Ÿ“ Spacing - Breathing Room

Padding and margin give your elements space to breathe. Think of padding as the space inside, margin as space outside!

Padding (Inside Space)

Use p- for padding (space inside the element).

Try p-2 (tiny), p-4 (small), p-6 (medium), p-8 (large), or p-12 (huge)

โœ๏ธ Edit Your Code:

๐Ÿ‘€ Live Preview:

More Padding = More Space Inside

Margin (Outside Space)

Use m- for margin (space outside the element).

I have margin!

๐Ÿ’ก Try m-4, m-6, m-8, or m-12. Use mx- for horizontal, my- for vertical!

Spacing Reference

Padding Classes:

  • โ€ข p-1 = 0.25rem (4px)
  • โ€ข p-2 = 0.5rem (8px)
  • โ€ข p-4 = 1rem (16px)
  • โ€ข p-6 = 1.5rem (24px)
  • โ€ข p-8 = 2rem (32px)
  • โ€ข p-12 = 3rem (48px)

Directional:

  • โ€ข pt- = padding top
  • โ€ข pb- = padding bottom
  • โ€ข pl- = padding left
  • โ€ข pr- = padding right
  • โ€ข px- = horizontal (left + right)
  • โ€ข py- = vertical (top + bottom)

๐Ÿ’… Beginner Confidence Tips

๐ŸŒท You don't need to memorize everything โ€” Google + docs are normal. Even pros look things up!

๐ŸŒท Copying examples is learning, not cheating. Start with examples, then modify them to make them yours!

๐ŸŒท Your code doesn't need to be perfect to be powerful. Working code > perfect code!

๐ŸŒท Experiment fearlessly! The interactive editors above let you try things without breaking anything.

๐ŸŒท Combine classes like outfits. Mix and match until it looks good to you!

๐Ÿš€ Next Steps

  • โœ… Practice with the interactive editors above
  • โœ… Try building a simple card or button
  • โœ… Check out the official Tailwind docs
  • โœ… Build something small - a profile card, a button, or a simple layout
  • โœ… Remember: every expert was once a beginner! ๐Ÿ’–