CSS Bug Hunt Medium +20 XP
Z-index Not Working
The z-index has no effect on this element.
CSSFind the bug
1
.card {2
z-index: 10;3
background: white;4
} The bug is on line 2
Select the correct fix
Show answer and explanation
Answer: Add position: relative (or absolute/fixed)
z-index only works on positioned elements (position: relative, absolute, fixed, or sticky).
Hint: z-index requires a position value.
What this challenge tests
Bug Hunt in CSS: z-index, positioning.