Color scheme

Typography Tokens and Web Font

This assignment upgrades the shared CSS architecture you have been building since Unit 2. You already have a handful of typography tokens in css/tokens/variables.css from the architecture and color assignments: a font family or two and a few fixed font sizes. You will replace those with a proper modular scale, make the scale adapt across viewport widths with clamp(), map the scale steps to semantic roles, load one custom web font with a deliberate font-display strategy, and roll the system across your portfolio.

When you are finished, your type system will be driven by one organized block of tokens in variables.css, exactly the way your color system is driven by colors.css. Changing your entire hierarchy will mean editing a few values in one place.

What You Are Building

Here is what your css/ directory should look like when this assignment is complete. The type tokens stay in variables.css where your other non-color tokens already live; you are not creating a separate typography file.


        [portfolio]
        ├── css/
        │   ├── base/
        │   │   ├── elements.css     # update: consume type tokens
        │   │   └── reset.css
        │   ├── tokens/
        │   │   ├── colors.css
        │   │   └── variables.css    # update: fluid scale + roles + font family
        │   └── main.css             # may update: @font-face or font import
        ├── fonts/                   # new: self-hosted font files (if self-hosting)
        ├── index.html               # update: apply the type system
        └── README.md                # update: document the type system
    

Assignment Instructions

1. Replace Your Font Sizes with a Modular Scale

Open css/tokens/variables.css. You likely have a few fixed font size tokens left over from earlier units. Choose a ratio for your scale, then generate a set of steps by repeatedly multiplying and dividing a base size by that ratio. The learn page covered the common ratios: minor third at 1.2, major third at 1.25, perfect fourth at 1.333, and others. Pick one that fits the character of your site.

Decide how many steps your site actually needs, typically six to eight spanning from small supporting text up to a large display size, and name each step by its position on the scale rather than by where you intend to use it. If you have existing tokens with different names, point the old names at the new ones so earlier declarations keep working while you migrate, the same way you handled legacy spacing names in the color assignment.


        :root {
            /* Modular scale steps: replace with values from your chosen ratio */
            --font-size-xs:  /* your smallest step */;
            --font-size-sm:  /* ... */;
            --font-size-md:  /* your base body size */;
            --font-size-lg:  /* ... */;
            --font-size-xl:  /* ... */;
            /* Continue with the steps your site needs */
        }
    

2. Make the Scale Fluid

Convert the steps that should scale so they adapt across viewport widths using clamp(). For each fluid step, decide on a minimum size at your smallest target viewport and a maximum size at your largest, then calculate the preferred value as a linear expression rather than guessing a single vw multiplier. Apply the slope and intercept math from the learn page so each step hits your exact target sizes at your chosen breakpoints.

Not every step needs to be fluid. Small supporting text often reads fine at a fixed size, while headings and display sizes benefit most from scaling. Make a deliberate choice for each step. Pair each size with a matching line height tuned by role: open line height for body sizes so prose breathes, tighter line height for large display sizes so multi-line headings hold together as one unit.

3. Map Steps to Semantic Roles

Add a second layer of tokens that map your numeric scale steps to the roles they serve, so components reference a purpose rather than a position on the scale. This is the same two-layer pattern your color file uses, where seeds feed semantic tokens and components consume only the semantic names. Changing which step a role uses then becomes a one-line edit.


        :root {
            /* Role tokens point at scale steps: choose mappings that fit your design */
            --font-size-body:       var(--font-size-md);
            --font-size-caption:    var(--font-size-xs);
            --font-size-heading-sm: /* point at one of your scale steps */;
            --font-size-heading-lg: /* ... */;
            --font-size-display:    /* your largest step */;
        }
    

4. Load One Custom Web Font

Add one custom font for a clear role on your site, such as your headings or your body text. You may self-host the files by downloading them into a fonts/ directory and writing your own @font-face blocks, or load the font through a service such as Google Fonts. Either way, declare an explicit font-display value rather than accepting the browser default, and provide a sensible fallback stack so text stays readable before the font arrives or if it fails to load.

Define a font family token in variables.css so the rest of your site references the font by role, not by name.


        :root {
            --font-family-heading: /* your font */, /* fallback stack */;
            --font-family-body:    /* your font or a system stack */;
        }
    

5. Apply the System to Your Site

Roll your tokens out across the real content on your portfolio. Update your base element styles and components so headings, body text, and captions consume your semantic typography tokens, and replace any hard-coded font sizes left from earlier work with the appropriate role token. Resize your browser from narrow to wide and confirm that your fluid steps scale smoothly without jumps, that your custom font loads with the fallback displaying sensibly beforehand, and that the hierarchy reads clearly at every width.

6. Commit, Push, and Verify

Stage your changes, commit with a descriptive message, and push to GitHub. Update your README.md to note where your type tokens live and which web font you chose. Verify that your deployment succeeds and that your live site shows the type system working across viewport sizes.

Submission

Complete the report below. When you are finished, download the PDF and submit it to Canvas. Your live site is graded by visiting it directly, so make sure your portfolio is deployed and current.

Typography Tokens and Web Font Report
Site Details

My live typography page is at and the source code is at .

Reflection
Fluid versus Fixed

You made some scale steps fluid and left others at a fixed size. Defend the boundary you drew. Why do those specific steps benefit from scaling while the others do not, and what would degrade in the reading experience if you had made every step fluid or none of them?

Choosing font-display

Evaluate your font-display choice for the font you loaded. Why is that value the right tradeoff for the role this font plays on your site, and what would a visitor on a slow connection actually experience differently if you had chosen one of the other values instead?

The Two-Layer Token System

You have now built this seed-to-semantic pattern twice, once for color and once for type. Assess where mapping scale steps to semantic roles paid off as you rolled the system across your pages, and identify one decision in your type system you would make differently if you rebuilt it from scratch. Explain why.