CSS AdvancedLesson 52Free preview
CSS Colors
This lesson is part of CSS · All levels
Summary
CSS supports many ways of writing colors: color names, notation HEX, RGB, RGBA, HSL, and HSLA. The HSL format (hue, saturation, lightness) is often preferred because it is more intuitive to regulate brightness and saturation. The alpha channel on the RGBA/HSLA makes the elements transparent.
Key points
- HEX is written with the # followed by 6 digits (or 3 short digits), for example `#1abc9c`
- `rgb()` receives three red-green-blue values 0-255; adds alpha to `rgba()`
- It consists of degrees of hue 0-360, percent saturation, and percent lightness
- Alpha 0 means full transparency, alpha 1 means completely opaque.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.