The default value for z-index is auto. : z index « CSS « HTML / CSS






The default value for z-index is auto.

  

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
* .stacking-context1 {
  position: absolute;
  left: 10px;
  top: 70px;
  background: red;
}

* .stacking-context2 {
  position: absolute;
  left: 223px;
  top: 120px;
  background: gold;
}

* .level2 {
  position: absolute;
  background: blue;
}

* .level3 {
  position: static;
  background: yellow;
}

* .level4 {
  float: left;
  background: black;
}

* .level5 {
  position: static;
  background: pink;
}

* .level6 {
  position: relative;
  background: gray;
}

* .level7 {
  position: absolute;
  background: gold;
}
</style>
</head>

<body>
<div class="stacking-context1 box"> 
<div class="caption"> Background and Borders of Stacking Context #1 <code>z-index:2</code></div> 
<span class="level2 box">Absolute <code>z-index:-999</code></span> 
<div class="level3 box">Static Block<br /> 
<span class="level4 box">Static Float</span> 
<span class="level5 box">Static Span</span><br /><p class="clear"></p> 
<span class="level6 box">Relative Span <code>z-index:0</code></span> 
<span class="level7 box">Absolute <code>z-index:999</code></span> 
</div> 
</div> 
<div class="stacking-context2 box">this is a test. this is a test. </div> 
</body>
</html>

   
  








Related examples in the same category

1.'z-index' Example
2.z-index number
3.z-index settings
4.z-index: auto
5.z-index: child index
6.Z-index Positioning
7.The z-index property controls how elements are layered along an invisible z-axis.
8.You can control the z-index explicitly, however, by providing an integer value to the z-index property.
9.Nested elements handle the z-index property differently. Descendant elements must always have a z-index higher than that of their parent.
10.opacity and z-index
11.z-index among li items
12.Inline style for z-index
13.z-index controls the stacking order of positioned elements.
14.A negative value places element below the normal flow, and a positive value places them above the flow.
15.Use z-index to change the overlap index
16.Set z-index to 100
17.z index, child index
18.Larger values move them closer to the user in the stacking order.
19.Stacking with z-index
20.z-index value
21.three layers of div tags
22.z-index and sibling selector
23.z-index and child selector