Menu
CoddyTech

Theme Spacing Tokens

Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 47 of 55.

A top-level theme declaration --spacing-gutter: 18px creates a named spacing value. The utility p-gutter then supplies 18 pixels of padding on all sides.

<div class="p-gutter">Museum sample</div>
@theme {
  --spacing-gutter: 18px;
  --spacing-inset: 22px;
  --spacing-wide: 34px;
  --spacing-air: 46px;
}

Named spacing communicates a reusable design decision without replacing the numeric scale. Keep related components on the same token when their spacing should change together; use one-off brackets for values that are not part of that shared design.

challenge icon

Challenge

Medium

Define a spacing token named panel with value 26px and apply it as padding on every side of the exhibition panel.

Keep the supplied content and element IDs. Edit the HTML utility classes or the requested CSS. Click Run preview to refresh the preview after edits, then use Check/Run code to grade your work.

Try it yourself

<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Practice studio</title><link rel="stylesheet" href="./styles.css"></head><body>
<div id="target" class="">Exhibition panel</div>
</body></html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals