z-index-stack-001

Z-index and stacking levels

WeasyPrint

This browser

Assertion
Boxes with greater stack levels are always formatted in front of boxes with lower stack levels.

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3     <head>
 4         <title>CSS Test: Z-index and stacking levels</title>
 5         <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
 6         <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#layers">
 7         <meta name="flags" content="">
 8         <meta name="assert" content="Boxes with greater stack levels are always formatted in front of boxes with lower stack levels.">
 9         <style type="text/css">
10             #div1
11             {
12                 position: relative;
13             }
14             div div
15             {
16                 height: 1in;
17                 position: absolute;
18                 width: 1in;
19             }
20             #div2
21             {
22                 background: orange;
23                 left: 30px;
24                 top: 30px;
25                 z-index: 2;
26             }
27             #div3
28             {
29                 background: yellow;
30                 left: 60px;
31                 top: 60px;
32                 z-index: 3;
33             }
34             #div4
35             {
36                 background: blue;
37                 left: 0;
38                 top: 0;
39                 z-index: 1;
40             }
41         </style>
42     </head>
43     <body>
44         <p>Test passes if the boxes are partially stacked on top of each other, and they are stacked in the following order from bottom to top: blue, orange, yellow.</p>
45         <div id="div1">
46             <div id="div2"></div>
47             <div id="div3"></div>
48             <div id="div4"></div>
49         </div>
50     </body>
51 </html>