06-XX-positioning-stacking-context.html 775 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Stacking contexts and opacity</title>
  6. <style>
  7. .a, .b, .c, .d {
  8. position: absolute;
  9. border: 2px solid #333;
  10. width: 200px;
  11. height: 100px;
  12. }
  13. .a {
  14. top: 10px;
  15. left: 10px;
  16. background-color: #f3bf8b;
  17. }
  18. .b {
  19. background-color: #5a6bff;
  20. opacity: 0.5;
  21. top: 20px;
  22. left: 20px;
  23. }
  24. .c {
  25. top: 10px;
  26. left: 10px;
  27. background-color: #e299f3;
  28. z-index: 9999;
  29. }
  30. .d {
  31. top: 40px;
  32. left: 40px;
  33. background-color: #acf3ae;
  34. z-index: 3;
  35. }
  36. </style>
  37. </head>
  38. <body>
  39. <div class="a"></div>
  40. <div class="b"><div class="c"></div></div>
  41. <div class="d"></div>
  42. </body>
  43. </html>