0
0
CSSmarkup~5 mins

Stacking context in CSS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a stacking context in CSS?
A stacking context is like a special group in CSS where elements are stacked in order. Elements inside this group stack above or below each other without mixing with elements outside the group.
Click to reveal answer
beginner
Name one CSS property that creates a new stacking context.
The position property with values relative, absolute, or fixed combined with a z-index value other than auto creates a new stacking context.
Click to reveal answer
beginner
How does the z-index property relate to stacking contexts?
z-index controls the order of elements inside a stacking context. Higher z-index means the element appears on top within that context.
Click to reveal answer
intermediate
True or False: Elements from different stacking contexts can overlap based on their z-index values alone.
False. Elements in different stacking contexts stack independently. Their z-index values only affect order inside their own context, not across contexts.
Click to reveal answer
intermediate
What happens visually when a new stacking context is created?
Visually, the new stacking context acts like a separate layer. Elements inside it stack among themselves, but the whole group stacks as one unit with other elements outside.
Click to reveal answer
Which CSS property combination creates a new stacking context?
Acolor: red;
Bfont-size: 16px;
Cmargin: 10px;
Dposition: relative; z-index: 1;
Inside a stacking context, which element appears on top?
AElement with the lowest z-index
BElement with the highest z-index
CElement that appears first in HTML
DElement with the largest size
True or False: z-index values affect stacking order across different stacking contexts.
AFalse
BTrue
COnly if z-index is greater than 10
DOnly for fixed position elements
Which of these CSS properties does NOT create a stacking context by itself?
Abackground-color
Btransform with any value
Cposition: fixed
Dopacity less than 1
What is the visual effect of stacking contexts on overlapping elements?
AStacking contexts have no effect on overlap
BElements from different contexts mix freely based on z-index
CEach stacking context stacks its elements independently
DElements with lower opacity always appear on top
Explain what a stacking context is and why it matters in CSS layout.
Think about how layers stack in real life, like papers on a desk.
You got /4 concepts.
    List common CSS properties or conditions that create a new stacking context.
    Remember properties that change how browsers group elements visually.
    You got /5 concepts.