CSS Opacity — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the CSS Opacity 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
Half-fade an element
easy10 minSet #box to 50% opacity using a decimal.
- 2
Use a percentage
easy10 minSet #box to 35% opacity using a percentage.
- 3
Fade it out entirely
easy10 minMake #box fully transparent but still take up space.
- 4
Fade the whole group
easy10 minSet #wrap to 0.75 so everything inside fades together.
- 5
Fade the background only
medium10 minA half-transparent background with fully opaque text.
Find the bug(5)
- 1
Fix the value above one
easy8 minAn opacity of 2 clamps to fully opaque.
- 2
Fix the missing percent sign
easy8 minWithout a % this reads as 35, which clamps to 1.
- 3
Fix visibility used to fade
easy8 minFading to nothing uses opacity.
- 4
Fix the opacity on the wrong element
easy8 minThe whole group should fade together.
- 5
Fix the faded text
easy8 minOnly the background should be translucent, not the contents.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace