Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

CSS That Scales: Layers, Tokens and Logical Properties (Summary)

You’ve finished CSS That Scales: Layers, Tokens and Logical Properties. You can now:

  • Organize a growing stylesheet with cascade layers
  • Drive its colors, spacing and type from design tokens
  • Lay it out with logical properties, so it holds up in any writing direction

The Lantern Press started with four !important flags, seventeen raw color values, and padding and borders pinned to the left. You put every rule in a layer under one order statement, so Teo’s components beat the vendor gallery without a longer selector, and the only !important left guards the reset.

You replaced raw values with tokens named by role, so each color appears once, as a primitive. And you switched margins, borders and sizes to logical properties.

The English pages look exactly as they did before, and Layla Haddad’s Arabic poem reads right to left, with its red line on the right, from the same stylesheet and no new layout rule.

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

00:00 You’ve finished CSS That Scales. Here’s what you can do now. You can organize a growing stylesheet with cascade layers. You can drive its colors, spacing and type from design tokens.

00:13 And you can lay it out with logical properties, so it holds up in any writing direction.

00:19 Here’s where The Lantern Press started: four !important flags, seventeen raw color values, and padding and borders pinned to the left.

00:29 First, you put every rule in a layer under one order statement. Teo’s components now beat the vendor gallery without a longer selector. The only !important left guards the reset.

00:41 Then you replaced raw values with tokens named by role, so each color appears once, as a primitive. Last, you switched margins, borders and sizes to logical properties.

00:55 The English pages look exactly as before. And Layla Haddad’s Arabic poem reads right to left, with its red line on the right. It’s the same stylesheet, with no new layout rule.

01:09 Remember these. Once every rule is in a layer, the order statement decides between layers, and specificity breaks ties inside one. With !important, the earlier layer wins.

01:21 Components read semantic or component tokens, never primitives. A derived token fills in its var() values where it’s declared, so declare it in the component that uses it.

01:32 And logical properties follow the text, in every direction.

01:38 You’ll find the finished Lantern Press in the course’s code download, in the project’s end folder. Next on the path is Fluid and Intrinsic Layouts, where type scales smoothly and components fit the space they’re given.

01:52 Thanks for learning with RealJS, and for helping Ama and Teo get their spring issue out.

Become a Member to join the conversation.