Intern Track Roadmap

CSS colors: HSL & hex

This course explains how CSS describes color on screens that mix red, green and blue light. It covers hex notation and its shorthand and alpha forms, rgb() with decimal numbers or percentages, and hsl() with hue, saturation and lightness. It separates alpha transparency inside a color from the opacity property on a whole element. It also covers named color keywords and currentColor, then builds a themed button and badge where HSL and custom properties produce related shades by changing one value at a time.

What you'll learn

  • ✓How additive red, green and blue light mixing underlies every CSS color
  • ✓Reading and writing hex colors, including 3, 4 and 8 digit forms
  • ✓Using rgb() and hsl() with modern and legacy syntax and alpha
  • ✓The difference between alpha in a color and the opacity property
  • ✓Named color keywords and currentColor as a single source of truth
  • ✓Building related color states with HSL and custom properties
Free preview · Lesson 1 4 min read

Why color needs a format

Say the word "blue" to another person and you're both picturing something close enough, sky, denim, a favorite mug. Say it to a browser and it means nothing until it's translated into numbers a screen can reproduce. Every pixel on every screen you own is built from tiny red, green, and blue…

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...