2013-08-05 20:09:31 +04:00
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
|
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<!-- https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context?redirectlocale=en-US&redirectslug=CSS%2FUnderstanding_z-index%2FThe_stacking_context
|
2017-08-11 17:22:39 +03:00
|
|
|
-->
|
2013-08-05 20:09:31 +04:00
|
|
|
<title>Understanding CSS z-index: The Stacking Context: Example Source</title>
|
|
|
|
<script type="text/javascript" src="../../test.js"></script>
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
* {
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
html {
|
|
|
|
padding: 20px;
|
|
|
|
font: 12px/20px Arial, sans-serif;
|
|
|
|
}
|
|
|
|
div {
|
|
|
|
opacity: 0.7;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
h1 {
|
|
|
|
font: inherit;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
#div1, #div2 {
|
2013-08-15 18:31:32 +04:00
|
|
|
border: 1px solid #696;
|
2013-08-05 20:09:31 +04:00
|
|
|
padding: 10px;
|
|
|
|
background-color: #cfc;
|
|
|
|
}
|
|
|
|
#div1 {
|
|
|
|
z-index: 5;
|
|
|
|
margin-bottom: 190px;
|
|
|
|
}
|
|
|
|
#div2 {
|
|
|
|
z-index: 2;
|
|
|
|
}
|
|
|
|
#div3 {
|
|
|
|
z-index: 4;
|
|
|
|
opacity: 1;
|
|
|
|
position: absolute;
|
|
|
|
top: 40px;
|
|
|
|
left: 180px;
|
|
|
|
width: 330px;
|
2013-08-15 18:31:32 +04:00
|
|
|
border: 1px solid #900;
|
2013-08-05 20:09:31 +04:00
|
|
|
background-color: #fdd;
|
|
|
|
padding: 40px 20px 20px;
|
|
|
|
}
|
|
|
|
#div4, #div5 {
|
2013-08-15 18:31:32 +04:00
|
|
|
border: 1px solid #996;
|
2013-08-05 20:09:31 +04:00
|
|
|
background-color: #ffc;
|
|
|
|
}
|
|
|
|
#div4 {
|
|
|
|
z-index: 6;
|
|
|
|
margin-bottom: 15px;
|
|
|
|
padding: 25px 10px 5px;
|
|
|
|
}
|
|
|
|
#div5 {
|
|
|
|
z-index: 1;
|
|
|
|
margin-top: 15px;
|
|
|
|
padding: 5px 10px;
|
|
|
|
}
|
|
|
|
#div6 {
|
|
|
|
z-index: 3;
|
|
|
|
position: absolute;
|
|
|
|
top: 20px;
|
|
|
|
left: 180px;
|
|
|
|
width: 150px;
|
|
|
|
height: 125px;
|
2013-08-15 18:31:32 +04:00
|
|
|
border: 1px solid #009;
|
2013-08-05 20:09:31 +04:00
|
|
|
padding-top: 125px;
|
|
|
|
background-color: #ddf;
|
|
|
|
text-align: center;
|
|
|
|
}
|
2017-08-11 17:22:39 +03:00
|
|
|
code {
|
|
|
|
font-family: monospace;
|
|
|
|
}
|
2013-08-05 20:09:31 +04:00
|
|
|
</style>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="div1">
|
|
|
|
<h1>Division Element #1</h1>
|
|
|
|
<code>position: relative;<br/>
|
|
|
|
z-index: 5;</code>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="div2">
|
|
|
|
<h1>Division Element #2</h1>
|
|
|
|
<code>position: relative;<br/>
|
|
|
|
z-index: 2;</code>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="div3">
|
|
|
|
|
|
|
|
<div id="div4">
|
|
|
|
<h1>Division Element #4</h1>
|
|
|
|
<code>position: relative;<br/>
|
|
|
|
z-index: 6;</code>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h1>Division Element #3</h1>
|
|
|
|
<code>position: absolute;<br/>
|
|
|
|
z-index: 4;</code>
|
|
|
|
|
|
|
|
<div id="div5">
|
|
|
|
<h1>Division Element #5</h1>
|
|
|
|
<code>position: relative;<br/>
|
|
|
|
z-index: 1;</code>
|
|
|
|
</div>
|
2017-08-11 17:22:39 +03:00
|
|
|
|
2013-08-05 20:09:31 +04:00
|
|
|
<div id="div6">
|
|
|
|
<h1>Division Element #6</h1>
|
|
|
|
<code>position: absolute;<br/>
|
|
|
|
z-index: 3;</code>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
2017-08-11 17:22:39 +03:00
|
|
|
</html>
|