The z-index property is used to displace elements on the z-axis i.e in or out of the screen. It is used to define the order of elements if they overlap on each other.
- auto: The stack order is equal to that of the parent(default).
- number: The stack order depends in the number.
- initial: Sets the property to its default value.
- inherit: Inherits the property from the parent element.
In the Example-1 the z-index is set to -1 therefore, the image appears behind the text but in Example-2 when the z-index is set to +1 the image hides the text.
Supported Browsers: The browser supported by z-index property are listed below:
- Google Chrome 1.0
- Edge 12.0
- Firefox 1.0
- Opera 4.0
- Apple Safari 1.0
- HTML | DOM Style zIndex Property
- CSS | transition-property Property
- How to override the CSS properties of a class using another CSS class ?
- Difference between bootstrap.css and bootstrap-theme.css
- CSS | table-layout Property
- CSS | text-align Property
- CSS | border-top-width Property
- CSS | isolation Property
- CSS | border-inline-start-style Property
- CSS | column-rule-width Property
- CSS | word-spacing Property
- CSS | animation-delay Property
- CSS | margin-top Property
- CSS | border radius property
- CSS | grid Property
- CSS | font-size-adjust Property
- CSS | visibility Property
- CSS | Display property
- CSS | grid-template-columns Property
- CSS | height Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.