css_z_index.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  4. <head>
  5. <title>z-index</title>
  6. <style type="text/css">
  7. div {
  8. position: absolute;
  9. }
  10. </style>
  11. </head>
  12. <body>
  13. <div style="background: #fff; opacity: 0.8; border: 6px solid red; z-index: 3; padding: 3em; top: 3em; left: 2em; width: 6em;">
  14. z-index: 3, order: 1
  15. </div>
  16. <div style="background: #fff; opacity: 0.8; border: 6px solid green; z-index: 2; padding: 3em; top: 6em; left: 6em; width: 6em;">
  17. z-index: 2, order: 2
  18. </div>
  19. <div style="background: #fff; opacity: 0.8; border: 6px solid blue; z-index: 1; padding: 3em; top: 1em; left: 4em; width: 6em;">
  20. z-index: 1, order: 3
  21. </div>
  22. <div style="background: #fff; opacity: 0.8; border: 6px solid red; z-index: auto; padding: 3em; top: 23em; left: 2em; width: 6em;">
  23. z-index: auto, order: 1
  24. </div>
  25. <div style="background: #fff; opacity: 0.8; border: 6px solid green; z-index: auto; padding: 3em; top: 26em; left: 6em; width: 6em;">
  26. z-index: auto, order: 2
  27. </div>
  28. <div style="background: #fff; opacity: 0.8; border: 6px solid blue; z-index: auto; padding: 3em; top: 21em; left: 4em; width: 6em;">
  29. z-index: auto, order: 3
  30. </div>
  31. </body>
  32. </html>