Style zIndex Property
Style zIndex Property
The zIndex property is used to either set or return the stack order of a positioned element. Elements having higher stack order will come in front of the document while those having lower stack order will be in the back of the document. It is quite useful for overlapping elements and we can solve this issue with it. Positioned elements are basically those elements that have position property set to absolute, relative, static, fixed, etc.
Syntax:-
Its syntax is:- object.style.zIndex OR object.style.zIndex = auto | number | initial | inherit
Return:-
Its return is:- string having stack order of an element
Further Explanation:-
Value | Description |
---|---|
auto | The browser determines the stack order of the element. |
number | An integer that defines stack order of the element. |
initial | Sets property to its default value. |
inherit | Inherits property from its parent element. |