0
0
CSSmarkup~20 mins

Common layering issues in CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Layering Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding stacking context in CSS
Which CSS property creates a new stacking context that affects layering of elements?
Aopacity: 0.9;
Bz-index: auto;
Cposition: static;
Ddisplay: block;
Attempts:
2 left
💡 Hint
Think about properties that change how browsers group elements for layering.
📝 Syntax
intermediate
2: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; }
Ac on top, a in middle, b at bottom
Ba on top, b in middle, c at bottom
Cb on top, c in middle, a at bottom
Da, b, c all layered equally
Attempts:
2 left
💡 Hint
Higher z-index means element is layered above lower z-index.
rendering
advanced
2: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; }
ABecause absolute positioning disables z-index
BBecause z-index only works on static positioned elements
CBecause opacity creates a new stacking context, limiting layering within parent
DBecause parent has higher z-index, child cannot be above
Attempts:
2 left
💡 Hint
Opacity affects stacking contexts and layering boundaries.
selector
advanced
2: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?
Aelement { position: static; }
Belement { transform: translateZ(0); }
Celement { display: inline; }
Delement { z-index: -1; }
Attempts:
2 left
💡 Hint
Some CSS properties create new stacking contexts by triggering GPU acceleration.
accessibility
expert
3: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?
AUse tabindex="-1" on all layered elements to prevent focus
BUse very high z-index values to force focus on top elements
CHide all layered elements with display:none to avoid confusion
DEnsure layering order matches logical reading order and use ARIA roles
Attempts:
2 left
💡 Hint
Think about how keyboard users navigate and how screen readers read content.