Course contentsShow
← Web Development
Lesson 186 of 2,9823. CSS FundamentalsFree lesson

Color Contrast and Readability

Understand WCAG contrast ratios for text and ensure sufficient color contrast for accessibility compliance.

Color Contrast and Readability

You'll learn how to ensure your text is readable by everyone through proper color contrast.

When you place text on a background, the difference in brightness between them determines how easy it is to read. This difference is called contrast. If your gray text on a light gray background looks fine to you, it might be completely unreadable to someone with low vision or color blindness.

What Are WCAG Contrast Ratios?

The Web Content Accessibility Guidelines (WCAG) define specific numerical ratios to measure contrast. These ratios range from 1:1 (no contrast at all, like white on white) to 21:1 (maximum contrast, like black on white).

WCAG Requirements:

  • Normal text: needs a contrast ratio of at least 4.5:1
  • Large text (18pt+ or 14pt+ bold): needs at least 3:1
  • AAA level (stricter): 7:1 for normal text, 4.5:1 for large text

Why This Matters

Think of contrast like the volume on a speaker. If the volume difference between your voice and background noise is too small, people can't understand you. Similarly, if your text color is too close to your background color, people can't read it.

Practical Application

When choosing colors, use online contrast checkers to test your combinations. For example, dark blue text (#003366) on white (#FFFFFF) has excellent contrast, but light blue (#87CEEB) on white fails badly.

Always test your color schemes, especially when using colored text, colored backgrounds, or semi-transparent overlays.

Key Takeaway: Use WCAG contrast ratios (4.5:1 minimum for normal text) to ensure your text is readable for all users, regardless of visual ability.