JavaScript Curriculum
Colors and Backgrounds
easyThe coffee shop page looks clean but monochrome. Time to bring in a warm color palette, a hero gradient, and card tints — all while keeping the text readable for everyone.
Colors and Backgrounds
Color is both creative and technical in CSS. You have five color formats to choose from, gradients to build, and accessibility standards to meet. This lesson covers all three.
Color Formats
CSS supports five color formats. Each has its strengths:
The most common format on the web. # followed by 6 hex digits (0–9, a–f) — two each for red, green, blue. Shorthand: #rgb for #rrggbb when digits repeat.
Backgrounds and Gradients
The background shorthand covers color, gradients, images, position, and size:
The simplest background. Use background (shorthand) or background-color.
.hero {
background: #1f6feb;
}Color Contrast — Accessibility Matters
Low contrast text fails WCAG accessibility guidelines and is genuinely hard to read for many users. The minimum contrast ratio for normal text is 4.5:1 (AA). Check every text/background combination:
The Grind Coffee
Specialty coffee, crafted daily
Your Challenge
Apply a full color palette to the coffee shop page — warm background, gradient hero, accessible text colors throughout.
Challenge
Style the page with: a warm hex color on body background, an HSL color on headings, an RGBA semi-transparent overlay on the .hero section using a linear-gradient, and verify your text/background contrast passes WCAG AA using the checker.
Colors and Backgrounds
easyThe coffee shop page looks clean but monochrome. Time to bring in a warm color palette, a hero gradient, and card tints — all while keeping the text readable for everyone.
Colors and Backgrounds
Color is both creative and technical in CSS. You have five color formats to choose from, gradients to build, and accessibility standards to meet. This lesson covers all three.
Color Formats
CSS supports five color formats. Each has its strengths:
The most common format on the web. # followed by 6 hex digits (0–9, a–f) — two each for red, green, blue. Shorthand: #rgb for #rrggbb when digits repeat.
Backgrounds and Gradients
The background shorthand covers color, gradients, images, position, and size:
The simplest background. Use background (shorthand) or background-color.
.hero {
background: #1f6feb;
}Color Contrast — Accessibility Matters
Low contrast text fails WCAG accessibility guidelines and is genuinely hard to read for many users. The minimum contrast ratio for normal text is 4.5:1 (AA). Check every text/background combination:
The Grind Coffee
Specialty coffee, crafted daily
Your Challenge
Apply a full color palette to the coffee shop page — warm background, gradient hero, accessible text colors throughout.
Challenge
Style the page with: a warm hex color on body background, an HSL color on headings, an RGBA semi-transparent overlay on the .hero section using a linear-gradient, and verify your text/background contrast passes WCAG AA using the checker.