Code has been added to clipboard!

The CSS Z-Index Property

Reading time 1 min
Published Sep 8, 2017
Updated Oct 1, 2019

What is z-index?

Using the CSS z-index property, you can manipulate vertical stacking for overlapping elements:

Example
img {         
   position: absolute;                
   z-index: -1;   
}

Note: if you worry about z-index not working, make sure to only use it for elements which have their position value defined as static.

Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid certificates of completion
Coursera
Pros
  • Professional service
  • Flexible timetables
  • A variety of features to choose from
Main Features
  • Professional certificates of completion
  • University-level courses
  • Multiple Online degree programs
Datacamp
Pros
  • Great user experience
  • Offers quality content
  • Very transparent with their pricing
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable

CSS z-index property syntax

To define the z-index for an element, you need to specify one value:

z-index: value;

The default value is auto, which means the stacking level depends on the parent container.

To define a custom level, use a unitless number. Elements with higher values will cover the ones with smaller values.

Browser support

Browser image
Chrome
1+
Browser image
Edge
12+
Browser image
Firefox
1+
Browser image
IE
4+
Browser image
Opera
4+
Browser image
Safari
1+

Mobile browser support

Browser image
Chrome
18+
Browser image
Firefox
4+
Browser image
Opera
All
Browser image
Safari
All

Latest Udacity Coupon Found:

Verified STAFF PICK

75% OFF COURSES

Udacity Black Friday Offer

The best time to save on Udacity courses is now - follow this coupon to access a 75% Udacity Black Friday discount & enjoy learning at a very low cost!

Expiration date: 25/01/2021
3176 People Used
Only 97 Left
Rating
5.0