Please enable JavaScript to use CodeHS

Web Design — Visual Design

Hierarchy and contrast

Not every element on a page is equally important. Visual hierarchy tells the reader what to look at first. Contrast makes things stand out. Together they make a page clear, accessible, and persuasive.

Visual Hierarchy ~10 min Middle / High School
The Big Idea

Visual hierarchy

Visual hierarchy is the order in which the eye processes information. Designers create hierarchy by changing size, weight, color, position, and spacing. A large, bold headline stands out more than a small paragraph. A bright button draws attention before a muted link.

Without hierarchy, every element competes for attention. With hierarchy, the page has a clear starting point and a clear next step. The reader feels guided rather than overwhelmed.


Vocabulary

Contrast

Contrast is the difference between elements. It can be contrast in color, size, weight, or texture. High contrast makes things pop. Low contrast makes things blend in or disappear.

Contrast is not just about aesthetics. It is a tool for meaning. A call-to-action button should contrast with the background. Important text should be more prominent than secondary text. Low-contrast text can be hard or impossible to read, especially in bright sunlight or for people with vision differences.


Design Skill

Accessibility and readability

Good designers think about all users, including people who see color differently or have low vision. Color contrast between text and background is one of the most important accessibility checks.

The Web Content Accessibility Guidelines (WCAG) recommend a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. The higher the ratio, the more legible the text. Designers use contrast checkers to make sure their colors pass these standards.


Critical Thinking

Guiding the eye

In Western cultures, readers usually scan pages in an F-pattern or Z-pattern: top to bottom, left to right. Hierarchy works with these patterns. The most important content goes at the top left or center. The call to action goes where the eye naturally rests.

Every visual decision sends a signal. A big gap says "new section." A bold color says "click here." A muted gray says "this is secondary." Good design is intentional about every signal.

Tip: squint at your design. If the most important elements still stand out, your hierarchy is probably working.


Interactive

Contrast checker

Enter a text color and a background color as hex codes. The demo calculates the contrast ratio and tells you whether it passes common accessibility standards. Try dark text on a light background, then light text on dark.

Design for everyone

Readable text is the foundation of good web design.

Learn more
Contrast ratio: —

Code

Hierarchy with CSS

Hierarchy tells the reader what to look at first. This CSS uses size, weight, and color to create clear contrast between headings and body text.


Your Turn

Check yourself

Look at a website. What is the biggest element on the page? What color is the main call-to-action button? How does the design guide your eye from top to bottom?

Your answer:

Sample answer: On a landing page, the headline is usually largest. The main button often uses a bright accent color. The eye moves from headline to description to button, following size and color contrast.


Check Yourself

Quick quiz

1. What does visual hierarchy do?

2. Why is contrast important for accessibility?

3. Which is a common reading pattern on the web?

Keep learning

You can guide attention and make text readable. Next, learn how to pull color, type, layout, and hierarchy into a consistent style guide.

Part of the Web Design: Visual Design series.