CSS Z-index — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the CSS Z-index 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
Raise an element
easy10 minGive #box a z-index of 10 with relative positioning.
- 2
Send an element back
easy10 minGive #box a z-index of -1.
- 3
Stack two elements
easy10 minPut #text above #box.
- 4
Create a stacking context
easy10 minUse opacity to create a context without positioning.
- 5
Layer an absolute element
medium10 minAbsolutely position #box and raise it.
Find the bug(5)
- 1
Fix z-index without position
easy8 minz-index is ignored on a static element.
- 2
Fix the misspelled property
easy8 minThe property is z-index.
- 3
Fix the value with a unit
easy8 minz-index takes a plain integer.
- 4
Fix the reversed stacking
easy8 min#text should sit above #box.
- 5
Fix the missing negative sign
easy8 minSending an element behind needs a negative index.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace