Set the #box text colour to oklch(0.7 0.15 200).
Acceptance criteria
- 1.Set the #box text colour to oklch(0.7 0.15 200).
CSS Tutorial · CSS Colors and Backgrounds
These 10 tasks go with the Modern Colors chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “Use alpha colors, perceptual color spaces, color mixing, and relative colors while preserving dependable fallbacks. It introduces modern RGB and HSL syntax, perceptual OKLCH palettes, alpha values, color-mix(), relative colors, and fallback strategies.” .
1.Use oklch()exercise · easy · 10 min
Set the #box text colour to oklch(0.7 0.15 200).
Passes when: Set the #box text colour to oklch(0.7 0.15 200).
2.Use lab()exercise · easy · 10 min · practice plan
Set the #box text colour to lab(50% 20 -30).
Passes when: Set the #box text colour to lab(50% 20 -30).
3.Mix two coloursexercise · easy · 10 min · practice plan
Give #box a background that is half red, half blue.
Passes when: Give #box a background that is half red, half blue.
4.Use oklab()exercise · easy · 10 min · practice plan
Set the #box text colour to oklab(0.5 0.1 -0.1).
Passes when: Set the #box text colour to oklab(0.5 0.1 -0.1).
5.Use lch()exercise · medium · 10 min · practice plan
Give #box a background of lch(50% 30 200).
Passes when: Give #box a background of lch(50% 30 200).
6.Fix the legacy notationbug fix · easy · 8 min
This should use oklch, not hsl.
Passes when: This should use oklch, not hsl.
7.Fix the commas in lab()bug fix · easy · 8 min · practice plan
Modern colour functions separate values with spaces.
Passes when: Modern colour functions separate values with spaces.
8.Fix the missing colour spacebug fix · easy · 8 min · practice plan
color-mix() needs an interpolation space.
Passes when: color-mix() needs an interpolation space.
9.Fix the misspelled functionbug fix · easy · 8 min · practice plan
The function is oklab.
Passes when: The function is oklab.
10.Fix lch confused with oklchbug fix · easy · 8 min · practice plan
This background should use lch().
Passes when: This background should use lch().
Between them these tasks cover oklch and lab, color-mix() and Wide-gamut colour.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.