40.1 @theme
@theme is part of the Tailwind CSS 4.3 workflow. Learn what the underlying CSS property or layout rule does first, then use the utility class to apply that rule consistently in markup.
Step by step
- Identify the CSS behavior behind @theme.
- Build a very small HTML example before placing it inside a large component.
- Apply the Tailwind utilities and inspect the result at multiple viewport widths.
- Add interaction, dark mode, RTL, or accessibility states when the component needs them.
- Refactor repeated markup into a reusable component only after the visual rule is understood.
10 practical examples
- Apply @theme to a course website and explain the decision you made.
- Apply @theme to a online store and explain the decision you made.
- Apply @theme to a banking app and explain the decision you made.
- Apply @theme to a school portal and explain the decision you made.
- Apply @theme to a clinic booking system and explain the decision you made.
- Apply @theme to a dashboard and explain the decision you made.
- Apply @theme to a restaurant site and explain the decision you made.
- Apply @theme to a mobile app and explain the decision you made.
- Apply @theme to a creator site and explain the decision you made.
- Apply @theme to a business landing page and explain the decision you made.
Hands-on example
@import "tailwindcss";
@theme {
--color-brand-500: oklch(0.62 0.19 250);
--font-display: "Inter", sans-serif;
}Expected output
A working responsive example demonstrating @theme, with no page-wide overflow and clear behavior across breakpoints.
Practice exercise
Create a fresh example for @theme using a different product, screen, component, or content set. Explain what changed and why.
40.2 Color Tokens
Color Tokens is part of the Tailwind CSS 4.3 workflow. Learn what the underlying CSS property or layout rule does first, then use the utility class to apply that rule consistently in markup.
Step by step
- Identify the CSS behavior behind Color Tokens.
- Build a very small HTML example before placing it inside a large component.
- Apply the Tailwind utilities and inspect the result at multiple viewport widths.
- Add interaction, dark mode, RTL, or accessibility states when the component needs them.
- Refactor repeated markup into a reusable component only after the visual rule is understood.
10 practical examples
- Apply Color Tokens to a course website and explain the decision you made.
- Apply Color Tokens to a online store and explain the decision you made.
- Apply Color Tokens to a banking app and explain the decision you made.
- Apply Color Tokens to a school portal and explain the decision you made.
- Apply Color Tokens to a clinic booking system and explain the decision you made.
- Apply Color Tokens to a dashboard and explain the decision you made.
- Apply Color Tokens to a restaurant site and explain the decision you made.
- Apply Color Tokens to a mobile app and explain the decision you made.
- Apply Color Tokens to a creator site and explain the decision you made.
- Apply Color Tokens to a business landing page and explain the decision you made.
Hands-on example
<div class="flex flex-wrap items-center gap-4 rounded-xl border bg-white p-6 shadow-sm">
<span class="font-semibold text-slate-900">Color Tokens</span>
</div>Expected output
A working responsive example demonstrating Color Tokens, with no page-wide overflow and clear behavior across breakpoints.
Practice exercise
Create a fresh example for Color Tokens using a different product, screen, component, or content set. Explain what changed and why.
40.3 Spacing Tokens
Spacing Tokens is part of the Tailwind CSS 4.3 workflow. Learn what the underlying CSS property or layout rule does first, then use the utility class to apply that rule consistently in markup.
Step by step
- Identify the CSS behavior behind Spacing Tokens.
- Build a very small HTML example before placing it inside a large component.
- Apply the Tailwind utilities and inspect the result at multiple viewport widths.
- Add interaction, dark mode, RTL, or accessibility states when the component needs them.
- Refactor repeated markup into a reusable component only after the visual rule is understood.
10 practical examples
- Apply Spacing Tokens to a course website and explain the decision you made.
- Apply Spacing Tokens to a online store and explain the decision you made.
- Apply Spacing Tokens to a banking app and explain the decision you made.
- Apply Spacing Tokens to a school portal and explain the decision you made.
- Apply Spacing Tokens to a clinic booking system and explain the decision you made.
- Apply Spacing Tokens to a dashboard and explain the decision you made.
- Apply Spacing Tokens to a restaurant site and explain the decision you made.
- Apply Spacing Tokens to a mobile app and explain the decision you made.
- Apply Spacing Tokens to a creator site and explain the decision you made.
- Apply Spacing Tokens to a business landing page and explain the decision you made.
Hands-on example
<div class="flex flex-wrap items-center gap-4 rounded-xl border bg-white p-6 shadow-sm">
<span class="font-semibold text-slate-900">Spacing Tokens</span>
</div>Expected output
A working responsive example demonstrating Spacing Tokens, with no page-wide overflow and clear behavior across breakpoints.
Practice exercise
Create a fresh example for Spacing Tokens using a different product, screen, component, or content set. Explain what changed and why.
40.4 Typography Tokens
Typography Tokens is part of the Tailwind CSS 4.3 workflow. Learn what the underlying CSS property or layout rule does first, then use the utility class to apply that rule consistently in markup.
Step by step
- Identify the CSS behavior behind Typography Tokens.
- Build a very small HTML example before placing it inside a large component.
- Apply the Tailwind utilities and inspect the result at multiple viewport widths.
- Add interaction, dark mode, RTL, or accessibility states when the component needs them.
- Refactor repeated markup into a reusable component only after the visual rule is understood.
10 practical examples
- Apply Typography Tokens to a course website and explain the decision you made.
- Apply Typography Tokens to a online store and explain the decision you made.
- Apply Typography Tokens to a banking app and explain the decision you made.
- Apply Typography Tokens to a school portal and explain the decision you made.
- Apply Typography Tokens to a clinic booking system and explain the decision you made.
- Apply Typography Tokens to a dashboard and explain the decision you made.
- Apply Typography Tokens to a restaurant site and explain the decision you made.
- Apply Typography Tokens to a mobile app and explain the decision you made.
- Apply Typography Tokens to a creator site and explain the decision you made.
- Apply Typography Tokens to a business landing page and explain the decision you made.
Hands-on example
<div class="flex flex-wrap items-center gap-4 rounded-xl border bg-white p-6 shadow-sm">
<span class="font-semibold text-slate-900">Typography Tokens</span>
</div>Expected output
A working responsive example demonstrating Typography Tokens, with no page-wide overflow and clear behavior across breakpoints.
Practice exercise
Create a fresh example for Typography Tokens using a different product, screen, component, or content set. Explain what changed and why.
40.5 Breakpoint Tokens
Breakpoint Tokens is part of the Tailwind CSS 4.3 workflow. Learn what the underlying CSS property or layout rule does first, then use the utility class to apply that rule consistently in markup.
Step by step
- Identify the CSS behavior behind Breakpoint Tokens.
- Build a very small HTML example before placing it inside a large component.
- Apply the Tailwind utilities and inspect the result at multiple viewport widths.
- Add interaction, dark mode, RTL, or accessibility states when the component needs them.
- Refactor repeated markup into a reusable component only after the visual rule is understood.
10 practical examples
- Apply Breakpoint Tokens to a course website and explain the decision you made.
- Apply Breakpoint Tokens to a online store and explain the decision you made.
- Apply Breakpoint Tokens to a banking app and explain the decision you made.
- Apply Breakpoint Tokens to a school portal and explain the decision you made.
- Apply Breakpoint Tokens to a clinic booking system and explain the decision you made.
- Apply Breakpoint Tokens to a dashboard and explain the decision you made.
- Apply Breakpoint Tokens to a restaurant site and explain the decision you made.
- Apply Breakpoint Tokens to a mobile app and explain the decision you made.
- Apply Breakpoint Tokens to a creator site and explain the decision you made.
- Apply Breakpoint Tokens to a business landing page and explain the decision you made.
Hands-on example
<div class="flex flex-wrap items-center gap-4 rounded-xl border bg-white p-6 shadow-sm">
<span class="font-semibold text-slate-900">Breakpoint Tokens</span>
</div>Expected output
A working responsive example demonstrating Breakpoint Tokens, with no page-wide overflow and clear behavior across breakpoints.
Practice exercise
Create a fresh example for Breakpoint Tokens using a different product, screen, component, or content set. Explain what changed and why.
Chapter 40 review — 10 questions and answers
1. What is the main purpose of @theme?
Answer: @theme is part of the Tailwind CSS 4.3 workflow. Learn what the underlying CSS property or layout rule does first, then use the utility class to apply that rule consistently in markup.
2. What is a common mistake with @theme?
Answer: Using @theme as memorized class names without understanding the CSS behavior, responsive context, accessibility, or component structure.
3. What is the main purpose of Color Tokens?
Answer: Color Tokens is part of the Tailwind CSS 4.3 workflow. Learn what the underlying CSS property or layout rule does first, then use the utility class to apply that rule consistently in markup.
4. What is a common mistake with Color Tokens?
Answer: Using Color Tokens as memorized class names without understanding the CSS behavior, responsive context, accessibility, or component structure.
5. What is the main purpose of Spacing Tokens?
Answer: Spacing Tokens is part of the Tailwind CSS 4.3 workflow. Learn what the underlying CSS property or layout rule does first, then use the utility class to apply that rule consistently in markup.
6. What is a common mistake with Spacing Tokens?
Answer: Using Spacing Tokens as memorized class names without understanding the CSS behavior, responsive context, accessibility, or component structure.
7. What is the main purpose of Typography Tokens?
Answer: Typography Tokens is part of the Tailwind CSS 4.3 workflow. Learn what the underlying CSS property or layout rule does first, then use the utility class to apply that rule consistently in markup.
8. What is a common mistake with Typography Tokens?
Answer: Using Typography Tokens as memorized class names without understanding the CSS behavior, responsive context, accessibility, or component structure.
9. What is the main purpose of Breakpoint Tokens?
Answer: Breakpoint Tokens is part of the Tailwind CSS 4.3 workflow. Learn what the underlying CSS property or layout rule does first, then use the utility class to apply that rule consistently in markup.
10. What is a common mistake with Breakpoint Tokens?
Answer: Using Breakpoint Tokens as memorized class names without understanding the CSS behavior, responsive context, accessibility, or component structure.