example_of_css_4.html 607 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CSS - 定位</title>
  6. <style type="text/css">
  7. .one {
  8. background-color: red;
  9. left: 50px;
  10. top: 50px;
  11. z-index: 100;
  12. }
  13. .two {
  14. background-color: green;
  15. left: 100px;
  16. top: 100px;
  17. z-index: 20;
  18. }
  19. .three {
  20. background-color: blue;
  21. left: 150px;
  22. top: 150px;
  23. z-index: 10;
  24. }
  25. .one, .two, .three {
  26. position: absolute;
  27. width: 200px;
  28. height: 200px;
  29. }
  30. </style>
  31. </head>
  32. <body>
  33. <div class="one"></div>
  34. <div class="two"></div>
  35. <div class="three"></div>
  36. </body>
  37. </html>