TExcelTAD
Home › Tailwind CSS › Tailwind Mini Project

Tailwind Mini Project

Let's put everything together and build a responsive landing page for Brewly, an imaginary coffee subscription. We'll go section by section, then assemble the full page at the end.

Step Section Skills used
1 Theme + navbar @theme, flex, responsive visibility
2 Hero grid, typography, gradients, buttons
3 Features responsive grid, cards, group-hover
4 Pricing highlighted card, lists, rings
5 Footer + full page layout, dark section, assembling

Tip: Drag the preview pane narrower and wider at every step. A landing page must look good from 360px phones to large desktops.

Step 1 — Theme and navbar

Start by defining the brand in @theme: a coffee colour scale and a display font. Every later step reuses these names, so changing the brand later means editing one block.

html · try it yourself
<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
  <style type="text/tailwindcss">
    @theme {
      --color-coffee-50: #fbf7f3;
      --color-coffee-100: #f3e8dc;
      --color-coffee-500: #a0673a;
      --color-coffee-700: #6f4424;
      --color-coffee-900: #3b2414;
      --font-display: "Georgia", "Times New Roman", serif;
    }
  </style>
</head>
<body class="bg-coffee-50 text-coffee-900">
  <header class="border-b border-coffee-100 bg-white/70 backdrop-blur">
    <nav class="mx-auto flex max-w-5xl items-center gap-6 px-4 py-3">
      <a href="#" class="font-display text-xl font-bold">☕ Brewly</a>
      <div class="ml-4 hidden gap-5 text-sm font-medium text-coffee-700 md:flex">
        <a href="#features" class="hover:text-coffee-900">Features</a>
        <a href="#pricing" class="hover:text-coffee-900">Pricing</a>
        <a href="#" class="hover:text-coffee-900">Reviews</a>
      </div>
      <a href="#pricing" class="ml-auto rounded-full bg-coffee-700 px-4 py-1.5 text-sm font-semibold text-white hover:bg-coffee-900">Start trial</a>
    </nav>
  </header>
</body>
</html>

On phones the links disappear (hidden md:flex) and only the logo and the call-to-action remain. (For a hamburger menu, reuse the pattern from the Navbar lesson.)

Step 2 — Hero section

A split hero: headline and buttons on one side, a big visual on the other. On phones the columns stack.

html · try it yourself
<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
  <style type="text/tailwindcss">
    @theme {
      --color-coffee-50: #fbf7f3; --color-coffee-100: #f3e8dc; --color-coffee-500: #a0673a;
      --color-coffee-700: #6f4424; --color-coffee-900: #3b2414;
      --font-display: "Georgia", "Times New Roman", serif;
    }
  </style>
</head>
<body class="bg-coffee-50 text-coffee-900">
  <section class="mx-auto grid max-w-5xl items-center gap-8 px-4 py-10 md:grid-cols-2">
    <div>
      <p class="text-xs font-semibold tracking-widest text-coffee-500 uppercase">Fresh every month</p>
      <h1 class="mt-2 font-display text-4xl font-bold text-balance md:text-5xl">Great coffee, delivered to your door</h1>
      <p class="mt-3 text-coffee-700 text-pretty">Hand-picked beans from small roasters, ground the way you like and shipped within 48 hours of roasting.</p>
      <div class="mt-5 flex flex-wrap gap-3">
        <a href="#" class="rounded-full bg-coffee-700 px-5 py-2.5 font-semibold text-white shadow-lg shadow-coffee-700/30 transition hover:-translate-y-0.5 hover:bg-coffee-900">Start free trial</a>
        <a href="#" class="rounded-full px-5 py-2.5 font-semibold text-coffee-700 ring-1 ring-coffee-500/40 hover:bg-coffee-100">How it works →</a>
      </div>
    </div>
    <div class="relative flex aspect-square items-center justify-center rounded-[2rem] bg-linear-to-br from-amber-200 via-orange-200 to-coffee-500 text-8xl shadow-2xl max-md:order-first max-md:aspect-video">
      ☕
      <span class="absolute right-4 bottom-4 rounded-full bg-white px-3 py-1 text-sm font-semibold shadow">★ 4.9 · 2,300 reviews</span>
    </div>
  </section>
</body>
</html>
Detail Classes
Balanced headline text-balance
Size jumps on bigger screens text-4xl md:text-5xl
Visual first on phones, shorter max-md:order-first max-md:aspect-video
Glowing primary button shadow-lg shadow-coffee-700/30

Step 3 — Features grid

Three cards that become one column on phones. Each icon tile reacts when the whole card is hovered.

html · try it yourself
<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
  <style type="text/tailwindcss">
    @theme {
      --color-coffee-50: #fbf7f3; --color-coffee-100: #f3e8dc; --color-coffee-500: #a0673a;
      --color-coffee-700: #6f4424; --color-coffee-900: #3b2414;
      --font-display: "Georgia", "Times New Roman", serif;
    }
  </style>
</head>
<body class="bg-white text-coffee-900">
  <section id="features" class="mx-auto max-w-5xl px-4 py-10">
    <h2 class="text-center font-display text-3xl font-bold">Why coffee lovers choose Brewly</h2>
    <div class="mt-8 grid gap-4 sm:grid-cols-3">
      <div class="group rounded-2xl bg-coffee-50 p-5 ring-1 ring-coffee-100 transition hover:-translate-y-1 hover:shadow-lg">
        <div class="flex size-12 items-center justify-center rounded-xl bg-white text-2xl shadow-sm transition group-hover:scale-110 group-hover:rotate-6">🌱</div>
        <h3 class="mt-4 font-semibold">Ethically sourced</h3>
        <p class="mt-1 text-sm text-coffee-700">Direct trade with farms that pay fair wages.</p>
      </div>
      <div class="group rounded-2xl bg-coffee-50 p-5 ring-1 ring-coffee-100 transition hover:-translate-y-1 hover:shadow-lg">
        <div class="flex size-12 items-center justify-center rounded-xl bg-white text-2xl shadow-sm transition group-hover:scale-110 group-hover:rotate-6">🔥</div>
        <h3 class="mt-4 font-semibold">Roasted to order</h3>
        <p class="mt-1 text-sm text-coffee-700">Your beans are roasted after you order, never before.</p>
      </div>
      <div class="group rounded-2xl bg-coffee-50 p-5 ring-1 ring-coffee-100 transition hover:-translate-y-1 hover:shadow-lg">
        <div class="flex size-12 items-center justify-center rounded-xl bg-white text-2xl shadow-sm transition group-hover:scale-110 group-hover:rotate-6">📦</div>
        <h3 class="mt-4 font-semibold">Pause any time</h3>
        <p class="mt-1 text-sm text-coffee-700">Skip, swap or cancel in one click. No contracts.</p>
      </div>
    </div>
  </section>
</body>
</html>

Step 4 — Pricing

Two plans side by side; the recommended one stands out with a dark background, a ring and a badge.

html · try it yourself
<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
  <style type="text/tailwindcss">
    @theme {
      --color-coffee-50: #fbf7f3; --color-coffee-100: #f3e8dc; --color-coffee-500: #a0673a;
      --color-coffee-700: #6f4424; --color-coffee-900: #3b2414;
      --font-display: "Georgia", "Times New Roman", serif;
    }
  </style>
</head>
<body class="bg-coffee-50 text-coffee-900">
  <section id="pricing" class="mx-auto grid max-w-3xl gap-5 px-4 py-10 sm:grid-cols-2">
    <div class="rounded-3xl bg-white p-6 ring-1 ring-coffee-100">
      <h3 class="font-semibold">Taster</h3>
      <p class="mt-2"><span class="font-display text-4xl font-bold">$14</span><span class="text-sm text-coffee-700">/month</span></p>
      <ul class="mt-4 space-y-2 text-sm text-coffee-700 *:before:mr-2 *:before:text-coffee-500 *:before:content-['✓']">
        <li>250 g of coffee</li><li>1 origin per month</li><li>Free shipping</li>
      </ul>
      <a href="#" class="mt-6 block rounded-full py-2 text-center font-semibold ring-1 ring-coffee-500/40 hover:bg-coffee-100">Choose Taster</a>
    </div>
    <div class="relative rounded-3xl bg-coffee-900 p-6 text-white shadow-2xl ring-4 ring-coffee-500/40">
      <span class="absolute -top-3 right-6 rounded-full bg-amber-400 px-3 py-0.5 text-xs font-bold text-coffee-900">Most popular</span>
      <h3 class="font-semibold">Enthusiast</h3>
      <p class="mt-2"><span class="font-display text-4xl font-bold">$26</span><span class="text-sm text-coffee-100">/month</span></p>
      <ul class="mt-4 space-y-2 text-sm text-coffee-100 *:before:mr-2 *:before:text-amber-400 *:before:content-['✓']">
        <li>500 g of coffee</li><li>2 origins per month</li><li>Free shipping + brewing guide</li>
      </ul>
      <a href="#" class="mt-6 block rounded-full bg-amber-400 py-2 text-center font-semibold text-coffee-900 hover:bg-amber-300">Choose Enthusiast</a>
    </div>
  </section>
</body>
</html>

The check marks are pseudo-elements: *:before:content-['✓'] on the <ul> gives every <li> a tick without touching the list items.

Step 5 — The complete page

Finally, assemble the sections and add a footer. The body is a flex column with min-h-dvh so the footer always sits at the bottom. Scroll inside the preview and resize it to check every breakpoint.

html · try it yourself
<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
  <style type="text/tailwindcss">
    @theme {
      --color-coffee-50: #fbf7f3; --color-coffee-100: #f3e8dc; --color-coffee-500: #a0673a;
      --color-coffee-700: #6f4424; --color-coffee-900: #3b2414;
      --font-display: "Georgia", "Times New Roman", serif;
    }
  </style>
</head>
<body class="flex min-h-dvh flex-col bg-coffee-50 text-coffee-900">
  <header class="sticky top-0 z-10 border-b border-coffee-100 bg-white/80 backdrop-blur">
    <nav class="mx-auto flex max-w-5xl items-center gap-6 px-4 py-3">
      <a href="#" class="font-display text-xl font-bold">☕ Brewly</a>
      <div class="ml-4 hidden gap-5 text-sm font-medium text-coffee-700 md:flex">
        <a href="#features" class="hover:text-coffee-900">Features</a>
        <a href="#pricing" class="hover:text-coffee-900">Pricing</a>
      </div>
      <a href="#pricing" class="ml-auto rounded-full bg-coffee-700 px-4 py-1.5 text-sm font-semibold text-white hover:bg-coffee-900">Start trial</a>
    </nav>
  </header>

  <main class="flex-1">
    <section class="mx-auto grid max-w-5xl items-center gap-8 px-4 py-10 md:grid-cols-2">
      <div>
        <h1 class="font-display text-4xl font-bold text-balance md:text-5xl">Great coffee, delivered to your door</h1>
        <p class="mt-3 text-coffee-700">Small-batch beans, roasted to order and shipped in 48 hours.</p>
        <a href="#pricing" class="mt-5 inline-block rounded-full bg-coffee-700 px-5 py-2.5 font-semibold text-white shadow-lg shadow-coffee-700/30 hover:bg-coffee-900">Start free trial</a>
      </div>
      <div class="flex aspect-video items-center justify-center rounded-[2rem] bg-linear-to-br from-amber-200 via-orange-200 to-coffee-500 text-8xl shadow-2xl max-md:order-first md:aspect-square">☕</div>
    </section>

    <section id="features" class="bg-white">
      <div class="mx-auto grid max-w-5xl gap-4 px-4 py-10 sm:grid-cols-3">
        <div class="rounded-2xl bg-coffee-50 p-5"><p class="text-2xl">🌱</p><h3 class="mt-2 font-semibold">Ethically sourced</h3></div>
        <div class="rounded-2xl bg-coffee-50 p-5"><p class="text-2xl">🔥</p><h3 class="mt-2 font-semibold">Roasted to order</h3></div>
        <div class="rounded-2xl bg-coffee-50 p-5"><p class="text-2xl">📦</p><h3 class="mt-2 font-semibold">Pause any time</h3></div>
      </div>
    </section>

    <section id="pricing" class="mx-auto max-w-5xl px-4 py-10 text-center">
      <h2 class="font-display text-3xl font-bold">Simple pricing</h2>
      <p class="mt-2 text-coffee-700">From <span class="font-bold text-coffee-900">$14/month</span>. Cancel whenever you like.</p>
    </section>
  </main>

  <footer class="bg-coffee-900 text-coffee-100">
    <div class="mx-auto flex max-w-5xl flex-col gap-3 px-4 py-6 text-sm sm:flex-row sm:items-center sm:justify-between">
      <p class="font-display text-lg font-bold text-white">☕ Brewly</p>
      <div class="flex gap-4"><a href="#" class="hover:text-white">About</a><a href="#" class="hover:text-white">Contact</a><a href="#" class="hover:text-white">Privacy</a></div>
      <p class="text-coffee-100/70">© 2026 Brewly Ltd.</p>
    </div>
  </footer>
</body>
</html>

Ideas to extend the project

Challenge Hint
Add a hamburger menu md:hidden button + aria-expanded + group-aria-expanded:
Add a dark theme @custom-variant dark (&:where(.dark, .dark *)); and dark: classes
Animate sections on load starting:opacity-0 starting:translate-y-4 transition duration-700
Add a testimonials carousel flex snap-x snap-mandatory overflow-x-auto with snap-center children
Extract components Turn each section into a component in React or Vue

Test yourself

Why define the coffee colours in @theme instead of using arbitrary values like bg-[#6f4424] everywhere?

  1. Arbitrary values don't work with hover
  2. Named tokens keep the design consistent and can be changed in one place
  3. @theme colours load faster
  4. Arbitrary values are removed in production

Which classes show the hero visual *above* the text only on screens narrower than 768px?

  1. order-first
  2. md:order-first
  3. max-md:order-first
  4. sm:order-last

What does *:before:content-['✓'] on a <ul> do?

  1. Adds a tick before the list
  2. Adds a tick pseudo-element before every direct child
  3. Replaces the bullets of nested lists only
  4. Nothing without a plugin