384152e0df4d941d2cc70f4e4742fb898e93ef22.svn-base 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html>
  4. <head>
  5. <!-- 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
  6. -->
  7. <title>Understanding CSS z-index: The Stacking Context: Example Source</title>
  8. <script type="text/javascript" src="../../test.js"></script>
  9. <style type="text/css">
  10. * {
  11. margin: 0;
  12. }
  13. html {
  14. padding: 20px;
  15. font: 12px/20px Arial, sans-serif;
  16. }
  17. div {
  18. opacity: 0.7;
  19. position: relative;
  20. }
  21. h1 {
  22. font: inherit;
  23. font-weight: bold;
  24. }
  25. #div1, #div2 {
  26. border: 1px solid #696;
  27. padding: 10px;
  28. background-color: #cfc;
  29. }
  30. #div1 {
  31. z-index: 5;
  32. margin-bottom: 190px;
  33. }
  34. #div2 {
  35. z-index: 2;
  36. }
  37. #div3 {
  38. z-index: 4;
  39. opacity: 1;
  40. position: absolute;
  41. top: 40px;
  42. left: 180px;
  43. width: 330px;
  44. border: 1px solid #900;
  45. background-color: #fdd;
  46. padding: 40px 20px 20px;
  47. }
  48. #div4, #div5 {
  49. border: 1px solid #996;
  50. background-color: #ffc;
  51. }
  52. #div4 {
  53. z-index: 6;
  54. margin-bottom: 15px;
  55. padding: 25px 10px 5px;
  56. }
  57. #div5 {
  58. z-index: 1;
  59. margin-top: 15px;
  60. padding: 5px 10px;
  61. }
  62. #div6 {
  63. z-index: 3;
  64. position: absolute;
  65. top: 20px;
  66. left: 180px;
  67. width: 150px;
  68. height: 125px;
  69. border: 1px solid #009;
  70. padding-top: 125px;
  71. background-color: #ddf;
  72. text-align: center;
  73. }
  74. </style>
  75. </head>
  76. <body>
  77. <div id="div1">
  78. <h1>Division Element #1</h1>
  79. <code>position: relative;<br/>
  80. z-index: 5;</code>
  81. </div>
  82. <div id="div2">
  83. <h1>Division Element #2</h1>
  84. <code>position: relative;<br/>
  85. z-index: 2;</code>
  86. </div>
  87. <div id="div3">
  88. <div id="div4">
  89. <h1>Division Element #4</h1>
  90. <code>position: relative;<br/>
  91. z-index: 6;</code>
  92. </div>
  93. <h1>Division Element #3</h1>
  94. <code>position: absolute;<br/>
  95. z-index: 4;</code>
  96. <div id="div5">
  97. <h1>Division Element #5</h1>
  98. <code>position: relative;<br/>
  99. z-index: 1;</code>
  100. </div>
  101. <div id="div6">
  102. <h1>Division Element #6</h1>
  103. <code>position: absolute;<br/>
  104. z-index: 3;</code>
  105. </div>
  106. </div>
  107. </body>
  108. </html>