Search code examples
cssz-index

What does does the z-index value 'unset' do?


According to the MDN docs on z-index, one possible z-index value is 'unset'.

/* Global values */
z-index: inherit;
z-index: initial;
z-index: unset;         /* <-------- */

What does using that value do?


Solution

  • Unset is a global value. It is not just a value for z-index.

    From MDN:

    The unset CSS keyword resets a property to its inherited value if it inherits from its parent, and to its initial value if not. In other words, it behaves like the inherit keyword in the first case, and like the initial keyword in the second case. It can be applied to any CSS property.