CSS Output Prediction Hard +35 XP
Stacking Context
Which element appears on top?
CSSRead-only
.a { position: relative; z-index: 100; }
.b { position: relative; z-index: 1; transform: scale(1); }What is the output?
Show answer and explanation
Answer: .b because transform creates a new stacking context
transform: scale(1) creates a new stacking context. Elements in a new context are painted as a group, affecting how z-index interacts.
Hint: Some properties create new stacking contexts.
What this challenge tests
Output Prediction in CSS: stacking-context, z-index, transform.