set z index code example
Example 1: css z-index
#nav {
position: fixed;
...
z-index: 2;
}
#main {
position: absolute;
...
z-index: 1;
}
Example 2: default z index
the default z-index is 0.
Example 3: what is a z index in css
Definition and Usage. The z-index property specifies the stack order of an element. An element with greater stack order is always in front of an element with a lower stack order. Note: z-index only works on positioned elements (position: absolute, position: relative, position: fixed, or position: sticky).
Default value: auto