1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
<?xml version="1.0" encoding="UTF-8"?>
<!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" xml:lang="en" lang="en">
<head>
<title>Flying Saucer: CSS Z-index Support</title>
<link rel="stylesheet" type="text/css" href="general.css" title="Style" media="screen" />
<link rel="stylesheet" type="text/css" href="print.css" title="Style" media="print" />
<style type="text/css">
body {
font-family: verdana;
height: 700px;
}
div.zlayer {
position: absolute;
border: 1px solid black;
width: 50px;
height: 50px;
}
</style>
</head>
<body>
<p class="link left-link"><a href="demoNav:back">Previous Page</a></p>
<p class="link right-link"><a href="demoNav:forward">Next Page</a></p>
<p id="fslogo">Flying Saucer XML/CSS2 Renderer</p>
<span id="pagebyline">CSS Z-index Support</span><br />
<p><b>Z-index support includes</b>: assigning the z-index to any positioned block-level element. In this example,
we have a series of divisions, each with a colored background, with a decreasing index so that each
subsequent element shows below (behind) the previous one. There is then a fixed element in the middle of
the page which has z-index of 0, and shows up behind all the others. If you resize the page to enable
the scrollbars, you can scroll and watch the fixed-position divisions scroll nicely <em>behind</em>
the colored boxes. z-index works on any positioned content, including relative inline layers.</p>
<div class="zlayer" style="background-color: maroon; top: 450px; left: 200px; z-index: 165;"></div>
<div class="zlayer" style="background-color: navy; top: 475px; left: 225px; z-index: 160;"></div>
<div class="zlayer" style="background-color: olive; top: 500px; left: 250px; z-index: 155;"></div>
<div class="zlayer" style="background-color: purple; top: 525px; left: 275px; z-index: 150;"></div>
<div class="zlayer" style="background-color: red; top: 550px; left: 300px; z-index: 145;"></div>
<div class="zlayer" style="background-color: silver; top: 575px; left: 325px; z-index: 140;"></div>
<div class="zlayer" style="background-color: teal; top: 600px; left: 350px; z-index: 135;"></div>
<div class="zlayer" style="background-color: white; top: 625px; left: 375px; z-index: 130;"></div>
<div class="zlayer" style="background-color: yellow; top: 650px; left: 400px; z-index: 125;"></div>
<div class="zlayer" style="background-color: aqua; top: 450px; left: 25px; z-index: 200;"></div>
<div class="zlayer" style="background-color: black; top: 475px; left: 50px; z-index: 195;"></div>
<div class="zlayer" style="background-color: blue; top: 500px; left: 75px; z-index: 190;"></div>
<div class="zlayer" style="background-color: fuchsia; top: 525px; left: 100px; z-index: 185;"></div>
<div class="zlayer" style="background-color: gray; top: 550px; left: 125px; z-index: 180;"></div>
<div class="zlayer" style="background-color: green; top: 575px; left: 150px; z-index: 175;"></div>
<div class="zlayer" style="background-color: lime; top: 600px; left: 175px; z-index: 170;"></div>
<div class="zlayer" style="background-color: white; top: 625px; left: 200px; z-index: 130;"></div>
<div class="zlayer" style="background-color: yellow; top: 650px; left: 225px; z-index: 125;"></div>
<div class="zlayer" style="position: fixed; background-color: lightgray; top: 400px; left: 25px; width: 500px; height: 20px; z-index: 0; margin-right: 25px;"></div>
<div class="zlayer" style="border: 0px; text-align: center; position: fixed; background-color: white; top: 425px; left: 25px; width: 500px; height: 20px; z-index: 0; margin-right: 25px;">This is behind (z-index 0)</div>
<div class="zlayer" style="position: fixed; background-color: lightgray; top: 450px; left: 25px; width: 500px; height: 20px; z-index: 0; margin-right: 25px;"></div>
</body>
</html>
|