Please enable JavaScript to use CodeHS

Web Design — Visual Design

Build a style guide

A style guide is a set of rules for how a site should look. It documents colors, fonts, spacing, and components so every page feels like it belongs to the same project.

Style Guide ~10 min Middle / High School
The Big Idea

What is a style guide?

A style guide is a document that collects all the design decisions for a website. It says: this is our primary color, this is our heading font, buttons look like this, cards look like that, and spacing follows this scale.

Style guides help teams work together. Designers, developers, and writers can all reference the same rules. The result is a consistent experience across pages, even when different people build them.


Vocabulary

Design tokens

Design tokens are the small, reusable values in a style guide: colors, font sizes, spacing units, border radii, and shadows. Instead of hard-coding a hex code every time, you give it a name like primary-color or space-medium.

Tokens make updates easier. If the brand color changes, you change the token in one place, and every button, link, and border updates automatically. Tokens also make it easier to keep designs consistent and to switch themes, like dark mode.


Design Skill

Components

A component is a reusable piece of UI, such as a button, card, navigation bar, or form input. Components combine design tokens into a specific pattern. A button component might define its background color, font, padding, border radius, and hover state all in one place.

When components are collected into a shared library, the style guide becomes a design system. Design systems are common in professional teams because they speed up development and keep products consistent.


Critical Thinking

Responsive and accessible

A style guide must work for everyone, not just people with large screens and perfect vision. That means testing on phones, tablets, and desktops. It also means checking contrast, keyboard navigation, and screen reader labels.

Accessibility is not an extra feature. It is part of good design. If some users cannot read or navigate your site, the design has failed for them.

Tip: start your style guide small. Define a primary color, a neutral, an accent, one heading font, one body font, and a spacing scale. Add components only when you need them.


Interactive

Style guide builder

Choose colors and a heading font, then see how the same component set changes. This is a tiny style guide in action.

Welcome to your site

This preview uses the tokens you selected above. The button and card update automatically.

Get started
Feature card
A component that reuses your colors and spacing.

Code

A CSS style guide

A style guide keeps a project consistent. This CSS file documents the fonts, colors, and spacing the whole team should use.


Your Turn

Check yourself

Imagine you are designing a style guide for a school club website. List three design tokens and one component you would define.

Your answer:

Sample answer: Tokens: primary color, heading font, medium spacing. Component: an event card with a title, date, and button that uses all three tokens.


Check Yourself

Quick quiz

1. What is a design token?

2. Why are components useful?

3. Which of these is part of a style guide?

Keep learning

You have finished the Web Design: Visual Design series. Next, learn how to get your work online with the Web Hosting series.

Final tutorial in the Web Design: Visual Design series.