Challenge - 5 Problems
Layering Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding stacking context in CSS
Which CSS property creates a new stacking context that affects layering of elements?
Attempts:
2 left
💡 Hint
Think about properties that change how browsers group elements for layering.
✗ Incorrect
Setting opacity less than 1 creates a new stacking context, affecting layering.
📝 Syntax
intermediate2:00remaining
Fixing z-index layering error
What is the output layering order of these elements if the CSS is applied as below?
CSS
div.a { position: relative; z-index: 1; } div.b { position: relative; z-index: 0; } div.c { position: relative; z-index: 2; }
Attempts:
2 left
💡 Hint
Higher z-index means element is layered above lower z-index.
✗ Incorrect
Elements with higher z-index appear on top when positioned.
❓ rendering
advanced2:00remaining
Why does a child element appear behind its parent?
Given this CSS, why does the child
div appear behind the parent even though it has a higher z-index?
.parent { position: relative; z-index: 1; }
.child { position: absolute; z-index: 10; opacity: 0.5; }Attempts:
2 left
💡 Hint
Opacity affects stacking contexts and layering boundaries.
✗ Incorrect
Opacity less than 1 creates a new stacking context, so child layering is limited inside parent.
❓ selector
advanced2:00remaining
Which CSS selector fixes layering conflict by isolating stacking context?
You want to isolate an element's layering so it doesn't interfere with siblings. Which CSS rule achieves this?
Attempts:
2 left
💡 Hint
Some CSS properties create new stacking contexts by triggering GPU acceleration.
✗ Incorrect
Using transform: translateZ(0); creates a new stacking context isolating layering.
❓ accessibility
expert3:00remaining
How to ensure layered elements remain accessible?
When layering elements with z-index, what is the best practice to keep content accessible to keyboard users?
Attempts:
2 left
💡 Hint
Think about how keyboard users navigate and how screen readers read content.
✗ Incorrect
Layering should not break logical order. Use ARIA roles and proper focus management for accessibility.