z-index
Understanding z-index
z-index determines the stack order of elements on a webpage. Elements with a higher z-index will be displayed in front of those with a lower index.
Default Value: The default value is
0.Stacking Context: Only positioned elements (
position: relative, absolute, fixed, sticky) with a definedz-indexform a stacking context.Auto Value: Setting
z-indextoautoplaces the element in the same stacking context as its parent.Hierarchy: In situations where two elements have the same
z-index, the HTML order determines the stacking, with the latter one appearing on top.Negative Values: Elements can have a negative
z-index, positioning them behind the parent elements.
This is a Conditional Value field. Such fields allow you to specify values directly OR use a Formula to specify a value. Conditional values are useful for specifying different values for changing situations, such as varying device types or screen sizes.
Possible Values
we have given a step input control by which user can increase or decrease the value of z-index. It can be any positive or negative number.

Example
Let's place two child block containers inside a parent container and set their position values appropriately. Initially, it will look like this:

Now, we set the z-index values for both child elements:
child1to 2, andchild2to 1.



Last updated