Project: Rebuild the Lantern Press Stylesheet

Your contents card now holds up in any writing direction, and so does the bio card. The rest of The Lantern Press’s site is another matter. Its full stylesheet still has the borrowed reset outside any layer, !important fixes at the bottom, raw colors in every rule, and margins pinned to the left and right of the screen.

In this project, you’ll rebuild that stylesheet from a brief instead of following a lesson line by line. Each step uses what you’ve already practiced, and an exercise after each one grades it. At the end, you’ll publish the zine’s first Arabic poem without writing a single new layout rule. Start with what Ama and Teo asked for.

Read Ama and Teo’s Brief

A brief says what the finished work must do and leaves the how to you. Ama sends this one as a short note:

The spring issue reprints the zine’s first poem in Arabic, the opening of Imru’ al-Qais’s Mu’allaqa, a sixth-century classic, and it should be on the site the day the issue comes out. Before that, please tidy the stylesheet. Every time Teo changes a color, something else breaks, and nobody wants to touch those !important lines. The English pages should look exactly the same afterward. The Arabic page should read right to left, as Arabic does.

Turned into rules, the note asks for a stylesheet that does four things:

  1. Layers settle the conflicts: Every rule belongs to a layer, wrapped in a layer block or imported with layer(), and one statement at the top declares the layers’ order. That order decides conflicts between layers. The Covergrid gallery sits in a low layer, and no !important remains outside the reset.
  2. Tokens hold every value: In the zine’s own rules in styles.css, colors, spacing, type sizes, and card widths come from tokens named by role, and components read only those roles or their own tokens.
  3. Sides follow the text: In those same rules, margins, padding, borders, sizes, and alignment use logical properties, except where a design is tied to the screen.
  4. The Arabic page needs no new layout rules: Its HTML sets the language and the direction, and the stylesheet you’ve already written does the rest.

Rules 2 and 3 leave gallery.css alone. It’s Covergrid’s file, imported as it is, so its raw values and physical properties stay in the vendor layer. The first three rules change the code, not the look. To check that you haven’t moved anything, keep these screenshots of the English pages as they look now, in a Chrome window 1,024 pixels wide. Here’s the issue page, from the masthead down to the bio card:

The issue page with a dark masthead, a contents card with a vertical issue label, two poem cards with red lines on their left, and the featured poet's bio card.
The Issue Page Your Rebuild Must Match

And here’s the page for Inés Duarte’s poem, “Lantern Weather”:

The poem page with the masthead, the poem in a card with a red line on its left, and Inés Duarte's bio card with a pull quote whose line is also on the left.
The Poem Page Your Rebuild Must Match

The fourth rule has a target too. When you’ve finished, the Arabic page will be a mirror image of the English one, with every red line on the right:

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

Become a Member to join the conversation.