z-index

Z-index is used to position a CSS box along the z axis, perpendicular to the display.Wherever two boxes overlap, the box with the largest z-index will appear on top.

Syntax
      z-index: index | auto | inherit ;

index - A positive or negative integer, or 0.
auto - The browser default.
inherit - inherit from the parent element.

z-index will only affect CSS boxes if they have a position value of absolute, fixed, or relative.

Examples:
body { z-index: -8; }
.emw3class { z-index: auto; }

#emw3id { z-index: 1; }

Try it:

The Z-index of the pink box is the default (0), if the z-index of this text is made larger than 0 then it will appear on top.

Browser Support: (CSS2+) buggy in IE 8

“The business of the advertiser is to see that we go about our business with some magic spell or tune or slogan throbbing quietly in the background of our minds” ~ Marshall McLuhan

Related:

position - Positioning method for an element.


Copyright © 2013-2022 Emw3.com
Some rights reserved