How to Use the Style Guide
For this midterm project, you'll build a multi-section website by implementing 8 different exercises. Each exercise focuses on a specific section (hero, navigation, content sections, etc.). The good news: you don't need to write any of the utility classes yourself! They're already provided in utility-classes.css.
Your job is to:
- Write semantic HTML with the correct structure
- Apply the right utility classes from
utility-classes.cssto make your content look good - Write section-specific CSS (e.g.,
hero.css,nav.css) for positioning, backgrounds, and unique styling
The best way to see all available classes is to open the interactive style guide:
What's in utility-classes.css?
The utility-classes.css file contains everything you need to style your sections. It includes:
1. CSS Variables (Colors & Layout)
Use these throughout your CSS instead of hardcoding values:
- Colors:
var(--black),var(--white),var(--persian-coral),var(--moss-green),var(--green),var(--ivory), etc. - Layout:
var(--container-max-width),var(--container-outer-padding)
2. Typography Classes
Pre-styled text classes for consistent typography:
.heading-1- Large section headings.heading-4,.heading-5,.heading-6- Various heading sizes.mega- Extra large hero text.xlarge,.large,.small- Body text sizes.eyebrow- Small labels above headings.caption- Small caption text
3. Button Classes
Ready-to-use button styles:
.btn.primary- Main action buttons (coral background).btn.tertiary- Text link buttons (with animated underline).btn.icon.arrow- Circular arrow buttons for cards.btn.icon.large- Large icon buttons
4. Layout Classes
Classes for structuring your content:
.container- Centers content with max-width.grid- CSS Grid container (you'll add your owngrid-template-columns).card- Card component with hover effects.column- Centered column layout.media- Image/video container with aspect ratio.panel- Section background (ivory background with padding)
5. Utility Classes
Small but useful classes:
.pill- Badge/tag elements (with.greenand.smallmodifiers).accessibility- Screen reader text (visually hidden).fancy-boxes- Decorative border effect for card images
How to Use the Style Guide
Visual Reference
The best way to see all available classes is to open the interactive style guide:
This visual demo shows:
- What each class looks like when rendered
- Example HTML code for each class
- How to combine classes for common patterns
Step-by-Step Process
When working on each exercise:
- Look at the screenshot - See what the final result should look like
- Check the style guide - Find classes that match the design:
- Need a large heading? Use
.heading-1 - Need a button? Use
.btn.primaryor.btn.tertiary - Need a card layout? Use
.cardwith.media
- Need a large heading? Use
- Write your HTML - Apply the appropriate classes:
<h2 class="heading-1">What We Do</h2> <a href="#" class="btn primary">Donate</a> <div class="container grid"> <!-- Your content --> </div> - Write section-specific CSS - Only write CSS for things NOT covered by utility classes:
- Positioning and layout (grid columns, flexbox)
- Background images
- Section-specific spacing
- Hover effects unique to that section
- Media queries
Example: Combining Classes
Here's how you might combine utility classes to create a card:
<a href="#" class="btn-container card">
<div class="media fancy-boxes">
<img src="../images/card.jpg" alt="">
</div>
<article>
<h3 class="heading-5"><span>Train</span> the next generation</h3>
<p class="small">Card description text.</p>
<span class="btn icon arrow">
<span class="accessibility">Card link</span>
</span>
</article>
</a>
This uses:
.btn-container- Makes the whole card clickable.card- Adds card styling and hover shadow.media.fancy-boxes- Image container with decorative borders.heading-5- Card heading (with colored<span>).small- Card description text.btn.icon.arrow- Circular arrow button.accessibility- Screen reader text
Important Rules
-
Don't redefine utility classes - If
utility-classes.csshas.btn.primary, don't write your own.btn.primaryin your section CSS file. Just use it! -
Use CSS variables - Instead of
color: #ff9d79;, usecolor: var(--persian-coral); -
Relative paths for images - Always use
../images/filename.jpg(notimages/filename.jpg) -
Link to utility-classes.css - Make sure your
index.htmlincludes:<link rel="stylesheet" href="../utility-classes.css"> -
Check the visual demo - When in doubt, open the style guide demo to see how classes are used
Quick Reference
| Need... | Use this class |
|---|---|
| Large section heading | .heading-1 |
| Card/article heading | .heading-4 |
| Card heading with colored word | .heading-5 with <span> inside |
| Large hero text | .mega |
| Large paragraph | .xlarge or .large |
| Small body text | .small |
| Primary button | .btn.primary |
| Text link button | .btn.tertiary |
| Circular arrow button | .btn.icon.arrow |
| Centered container | .container |
| Grid layout | .grid (add your own grid-template-columns) |
| Card component | .card |
| Image container | .media |
| Badge/tag | .pill (add .green or .small as needed) |
Next Steps
- Start with Exercise 1: Hero Section - It's provided as a complete solution so you can see the pattern
- Use the Style Guide Demo as your visual reference
- Follow the pattern from Exercise 1 for Exercises 2-8