Tricky CSS Questions

This CSS quiz is for people who think they know CSS well. It covers the behaviors that surprise even experienced developers: stacking contexts, margin collapsing through parents, percentage padding, :is() specificity, sticky elements that will not stick and flex items that will not shrink.

कठिन 10 सवाल ~8 मिनट पास होने के लिए 80%

मोड चुनें

आप गेस्ट के तौर पर खेल रहे हैं: XP और streak सेव रखने के लिए साइन इन करें।

सैंपल सवाल

सवाल 1 / 10

.child and .b overlap. Which one is drawn on top?

<style>
  .a { position: relative; z-index: 1; }
  .child { position: relative; z-index: 9999; }
  .b { position: relative; z-index: 2; }
</style>
<div class="a"><div class="child">child</div></div>
<div class="b">b</div>
जवाब दिखाएं

D. .b, because .child is trapped inside .a's stacking context .a with position and z-index creates a stacking context, and .child's 9999 only counts inside it. At the outer level .a (1) is compared with .b (2), so .b and everything in it wins.

इस क्विज़ में क्या है

  • Stacking contexts and why z-index: 9999 can lose
  • Margins that escape their parent and percentage padding
  • Specificity of :is() and exact attribute selectors
  • position: sticky and position: fixed surprises
  • Inline-block whitespace, 100vh on mobile and flex min-width

अक्सर पूछे जाने वाले सवाल

क्या अकाउंट ज़रूरी है?

नहीं। कोई भी खेल सकता है। XP, streak, badge और हिस्ट्री सेव रखने के लिए साइन इन करें।

क्या मैं इसे दोबारा दे सकता हूं?

हां। आपका बेस्ट स्कोर सेव रहता है, और हर बार सवाल और जवाब शफ़ल होते हैं।