CSS Gradients — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the CSS Gradients lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Exercises(5)
- 1
Angle a gradient
easy10 minGive #box a 45deg red-to-blue gradient.
- 2
Position the colour stops
easy10 minRed at 0% and blue at 100%.
- 3
Use three stops
easy10 minRed, then yellow in the middle, then blue.
- 4
Use a conic gradient
easy10 minGive #box a conic red-to-blue gradient.
- 5
Repeat a gradient
medium10 minA repeating 45deg gradient from red to blue every 20px.
Find the bug(5)
- 1
Fix the angle with no unit
easy8 minA gradient angle needs deg.
- 2
Fix the stop with no unit
easy8 minA colour stop position needs a percentage or length.
- 3
Fix the gradient on the wrong property
easy8 minA gradient is an image, not a colour.
- 4
Fix radial used where conic was meant
easy8 minThis gradient should sweep around a centre point.
- 5
Fix the gradient that does not repeat
easy8 minUse the repeating variant of the function.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace