Version: Level 2
Compability: IE4+ N6
The z-index property sets the stacking order for a group of elements whose x/y coordinates overlap the same area. This property is not inherited.
Elements can have 3-dimensions. The x- and y-components set the element position as viewed on the monitor. The z-component determines which elements can appear to lie on top of other elements, or conversely, which elements appear to lie under other elements.
The higher (or more positive) the number, the higher the element is in the stacking order. Higher numbered elements overlay lower numbered elements (2 overrides 1).
<html>
<head>
<title>z-index example</title>
<style type="text/css">
.logo {
position: absolute;
left: 0.5in;
top: 0.5in;
}
</style>
</head>
<body>
<div id="word1" class="logo" style="z-index: 1">
<br>
<span style="color: red; font-size: 100px;">Guru</span>
</div>
<div id="word2" class="logo" style="z-index: 2">
<span style="color: blue; font-size: 70px;">Dev</span>
</div>
</body>
</html>
Guru
Dev