O'Reilly logo

Web Programming with HTML5, CSS, and JavaScript by Dean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10.12 Using z-index to Stack Elements on Top of Each Other

In this section, we continue our discussion of manipulating CSS with JavaScript, but now the emphasis is more on the CSS than the JavaScript. You’ll be learning about the CSS z-index property and then how to change its value using JavaScript.

z-index Property

If you want to stack elements visually on top of each other, use absolute positioning to achieve the overlap, and then use the z-index CSS property to determine the order of elements along the web page’s z axis. The z axis comes from the Cartesian coordinate system, which has x, y, and z axes for describing a three-dimensional space. The x and y axes run horizontally and vertically. With CSS, the z axis runs from the monitor ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required