017-z-index.html 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>017 z-index</title>
  6. <style>
  7. html, body { margin: 0; padding: 0; background: #ffffff; color: #202020; }
  8. body { font-family: sans-serif; font-size: 13px; }
  9. h1 { font-size: 20px; margin: 10px 0 4px 10px; }
  10. p { margin: 0 0 10px 10px; }
  11. .pane { float: left; width: 440px; margin-left: 10px; }
  12. .label { background: #eeeeee; padding: 4px 6px; margin-bottom: 4px; }
  13. .stage { background: #eeeeee; padding: 8px; border: 1px solid #999999; }
  14. .cover { position: relative; width: 150px; height: 150px; }
  15. .box { position: absolute; width: 80px; height: 80px; }
  16. .after { background: #333333; color: #ffffff; height: 24px; margin-top: 8px; padding-left: 4px; }
  17. </style>
  18. </head>
  19. <body>
  20. <h1>017 &middot; z-index</h1>
  21. <p>Red must be on top, then green, then blue, in both panes.</p>
  22. <div class="pane">
  23. <div class="label">A: z-index</div>
  24. <div class="stage">
  25. <div class="cover">
  26. <div class="box" style="left: 0; top: 0; background: #cc2222; z-index: 3"></div>
  27. <div class="box" style="left: 30px; top: 30px; background: #22aa44; z-index: 2"></div>
  28. <div class="box" style="left: 60px; top: 60px; background: #2244cc; z-index: 1"></div>
  29. </div>
  30. <div class="after">after</div>
  31. </div>
  32. </div>
  33. <div class="pane">
  34. <div class="label">B: document order reference</div>
  35. <div class="stage">
  36. <div class="cover">
  37. <div class="box" style="left: 60px; top: 60px; background: #2244cc"></div>
  38. <div class="box" style="left: 30px; top: 30px; background: #22aa44"></div>
  39. <div class="box" style="left: 0; top: 0; background: #cc2222"></div>
  40. </div>
  41. <div class="after">after</div>
  42. </div>
  43. </div>
  44. </body>
  45. </html>