The video picks up with the In This Issue list that the end of the previous lesson, Name Tokens by Role, had you add to your site.
In this video, Teo made the contents section denser by overriding a spacing token on the section, but the space between the list’s entries didn’t change. You traced where the browser fills in a var() inside a custom property, and then moved the derived token to the component that uses it. Here are the main points and the fixed rules.
Key Points
- A
var()inside a custom property is filled in on the element that declares the property. Elements below inherit the result, with thevar()already replaced by a value. --space-list: calc(var(--space-gap) * 2)declared on:rootbecomescalc(1rem * 2)there, and that’s what the list inherits. Nothing in it points at--space-gapanymore, so overriding--space-gapon.contentsdoesn’t change it, and the entries stay 32 pixels apart.- The Computed pane shows the real gap (
row-gap: 32px), and the Styles pane shows that the override did reach the list. - A derived token follows an override only on its own element or on an element that contains it.
- Declare a derived token in the component that uses it. Then it’s filled in with the value the component inherits, and the entries close up to 16 pixels. Moving the line is the fix. The new name,
--poem-list-gap, only says that the token belongs to the list.