Most stylesheets grow one rule at a time, until their parts start to fight. The usual fixes, a longer selector and then !important, win one fight and make every later change harder. This course is about stylesheets that keep working as sites grow.
It’s the first of five courses on the Modern CSS and Accessible Interfaces learning path, which takes you from building pages to building interfaces that scale, adapt to where they’re placed, and work for everyone. Later courses build on the organized stylesheet you’ll make here. This course also stands on its own, so you can take it whether or not you plan to follow the whole path.
You’ll work on the website of The Lantern Press, a small quarterly poetry zine that Ama edits and Teo designs. Its stylesheet has a borrowed reset, a third-party cover gallery, and Teo’s page styles, and right now the gallery’s small gray capitals win over the serif captions Teo wants.
You’ll fix that kind of mess one lesson at a time, until the same stylesheet draws an English poem page and its Arabic twin, reading right to left. Written with left and right, the poem card’s red line would stay on the left of the Arabic page.
What You’ll Learn
By the end of this course, you’ll be able to:
- 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
Design tokens are custom properties named for the job a value does, such as --color-accent for the zine’s brick red, rather than for the value itself. Your rules use the tokens, so one edit to a token reaches the whole site.
In the project, you’ll rebuild the whole Lantern Press stylesheet and publish the zine’s first Arabic poem page, with no new layout rule.
Before You Start
You need the HTML and CSS to build a page: the cascade, the box model, and custom properties. Where a lesson relies on one of these, it recaps it in a line. You won’t need any JavaScript.
The course also assumes the basics of cascade layers, so the first lesson can start using them straight away:
- An
@layerblock puts the rules inside it in a named layer, such as@layer components { ... }, and an@layerstatement at the top of the stylesheet sets the order of the layers. - Between two layers, the later layer wins, whatever the specificity of its rules.
- Styles outside any layer beat every layered style, so a plain rule that isn’t in a layer wins over a rule in
components.
If those are new to you, then work through the lesson Order Your Rules With Cascade Layers in Boxes, Type, and Visual Design With CSS first.
You’ll also need a current version of Chrome or Edge, and an editor with a live preview that reloads the page each time you save.
How the Course Works
The course has three sections: Cascade Layers, Design Tokens, and Logical Properties. Each section has text lessons, a short video, and a coding exercise that you write and run in your browser, where automated tests check your work.
Then comes the project, The Lantern Press Stylesheet. You’ll rebuild the zine’s stylesheet from a brief, and three exercises grade it step by step. Afterward, you’ll talk through your choices with the RealJS mentor, an AI chat that opens from a button in that lesson. A quiz and a summary video close the course.
Get the Code
The code download below this video has one numbered folder for each lesson, in course order. The project’s folder holds two copies of the site. In project/start, you’ll find the project’s starting site, and in project/end, a finished version. Keep project/end for comparing your work when you’re done.
Open the starting site from the first lesson’s folder in your editor, and start the live preview from its index.html, which is the zine’s issue page. In the first lesson, Layer the Vendor Gallery, you’ll find out why the gallery’s styles keep winning.