HTML & CSS · Junior · Question 22 of 75

Which elements does z-index apply to?

Explanation

z-index controls stacking order and applies to positioned elements and to children of flex/grid containers. On a regular static block outside flex/grid it is ignored. Remember stacking contexts: z-index: 9999 won't help if the parent sits in a "lower" context.

Further reading

Problem with a question

HTML & CSS · Junior · question 22

Test yourself

Take the HTML & CSS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz