Variable Spellbook To Go
The Arcane Ledger
Section titled “The Arcane Ledger”You’ve now learned how to wield CSS custom properties like a spellcaster:
- Declare named runes (variables) with
--token-name - Summon their power using
var() - Scope them globally, by circle (section), or inside a single glyph (component)
- Hand the wand to JavaScript to rewrite runes at runtime
- Use variables as intensity dials for motion, glow, lift, duration, and theme
You’re officially ready to build interfaces that feel enchanted, not hard-coded.
🔮 Your Wizard’s Laboratory — Demo Repo
Section titled “🔮 Your Wizard’s Laboratory — Demo Repo”Every spell in this module lives inside the Wizard Lab — the evolving workshop where tokens glow, themes shift, and entire interfaces bow to a single variable.
If you want to feel variable-driven design rather than just read about it, dive into the repo and start tweaking the runes yourself. Change one token. Watch the world adjust.
Demo Repo:
View Demo Repo on GitHub
# Clone this spell-lab locallygit clone https://github.com/ProfessorSolo/WebDevTnT-CSS-Variable-Wizardry.gitThis demo includes four enchanted chambers:
- The Ingredient Chamber — global tokens & variable basics
- The Circle of Scopes — how runes change meaning depending on where they’re cast
- The Wand Room — JS rewriting tokens in real time
- The Sigil of Motion — performance-safe hover magic driven by variables
Bookmark the repo — this is your spell practice dojo for the entire module.
🎥 Lesson Video — Variable Wizardry in Action
Section titled “🎥 Lesson Video — Variable Wizardry in Action”Seeing variables cascade, override, and merge in real time makes the whole system click — it’s the difference between reading a spell and watching it spark.
Watch the CSS Variable Wizardry Lesson on YouTube
Watching the tokens shift live gives you the intuition the docs can’t.
Once you’ve seen the magic unfold, the Wizard Lab becomes pure playground.
🧪 Guided Experiments in the Wizard Lab
Section titled “🧪 Guided Experiments in the Wizard Lab”When exploring the Wizardry Demo, try these quests:
1. Ingredient Chamber — Rune Basics
Section titled “1. Ingredient Chamber — Rune Basics”- Modify global runes like:
--arcane-accent--page-bg--glyph-border
- Add your own rune (e.g.
--label-bg) and use it behind glyph titles. - Inspect how many UI elements pull from a single rune change.
2. Circle of Scopes — Power Boundaries
Section titled “2. Circle of Scopes — Power Boundaries”- Identify runes declared in:
- The root grimoire (
:root) - A circle glyph wrapper
- A single spell-card
- The root grimoire (
- Override a rune at each level and observe who inherits the new meaning.
- Practice tracing scope using DevTools → Computed → “Show all CSS variables”.
3. Wand Room — JavaScript Tokenbinding
Section titled “3. Wand Room — JavaScript Tokenbinding”- Add a new ritual button (
data-theme="astral"ordata-theme="emberforge"). - Declare one new rune (e.g.
--card-ring-color) and update it per ritual. - Log each rune change using:
getComputedStyle(document.documentElement).getPropertyValue('--rune');
4. Sigil of Motion — Performance Glyphs
Section titled “4. Sigil of Motion — Performance Glyphs”- Confirm hover interactions use only:
transformopacitybox-shadow
- Experiment with:
--lift-distance--shadow-strength--transition-ms
- Crank values too high, then refine — learn the finesse of subtle magic.
🎯 Practice Quests for the Aspiring Archmage
Section titled “🎯 Practice Quests for the Aspiring Archmage”Level 1 — Rune Cleanup
Section titled “Level 1 — Rune Cleanup”- Find repeated literal values in the demo (colors, radii, spacing).
- Promote them to runes in
:root. - Replace their usages with
var(--your-rune).
Level 2 — Alternate Circle
Section titled “Level 2 — Alternate Circle”- Create a new themed circle (e.g. “Moonlit Sanctum” or “Infernal Atrium”).
- Override at least three runes inside that wrapper.
- Confirm components inherit without any HTML changes.
Level 3 — Ritual Enhancement
Section titled “Level 3 — Ritual Enhancement”- Extend the Wand Room with:
- A live rune readout panel
- A slider or input that updates a numeric rune (
--glow-intensity,--blur-strength) - A toggle that flips between two rune sets using one wrapper class
🧾 NotebookLM Arcana
Section titled “🧾 NotebookLM Arcana”For this module, you’ll have two powerful artifacts:
- Arcane Infographic — a one-page visual guide to variables, scoping, and JS access
Infographic (PNG)
- Spellbook Slide Deck — the NotebookLM study guide
Slide Deck (PDF)
These scrolls help you revisit concepts quickly and clearly.
🤖 AI Training Grounds (Copy / Paste This Spell)
Section titled “🤖 AI Training Grounds (Copy / Paste This Spell)”Act as my CSS Variable Wizardry trainer.
Using the concepts from the module:- Declaring & using CSS custom properties- Scoping variables globally, by section, and per-component- Updating variables at runtime with JavaScript- Driving motion, shadows, and timing from variable intensity dials
Create an interactive “Wizard’s Lab” playground with:
1. Global runes declared in :root for color, radius, glow, shadow, and timing.2. A section wrapper (“circle”) that overrides at least two runes.3. A spell-card component that: - Has component-level default runes - Inherits overrides from its circle or the root4. A JavaScript Wand Panel with buttons or a select menu that: - Changes runes in real time using setProperty() - Displays a live readout of at least 3 rune values5. All hover magic must use transform + opacity (no layout animation).
Output:- A single HTML file with inline CSS + JS- Clear comments- No external libraries➡️ New Paths
Section titled “➡️ New Paths”With variables thoroughly in your spellbook:
- Selector Spells will sharpen your aim
- Function Forge will help you combine runes with
calc(), gradients, and color functions - Arcane Animations later will flow naturally once your values live in tokens
For now, keep asking:
“Should this be a rune?”
If you use it more than once, the answer is: yes, apprentice.