定位.css 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. * {
  2. /* margin: 0;
  3. padding: 0; */
  4. box-sizing: border-box;
  5. }
  6. div {
  7. width: 200px;
  8. height: 200px;
  9. font-size: 30px;
  10. font-weight: bold;
  11. color: #fff;
  12. }
  13. .box1 {
  14. margin-top: 15px;
  15. background: #0f0;
  16. }
  17. .box2 {
  18. margin-top: 15px;
  19. background: #0ff;
  20. /* position: fixed; */
  21. /* top: 215px; */
  22. /* left: 400px; */
  23. }
  24. .box3 {
  25. margin-top: 15px;
  26. background: #ff0;
  27. /* position: sticky;
  28. top: 40px; */
  29. }
  30. .box4 {
  31. margin-top: 15px;
  32. background: #f00;
  33. /* position: static; */
  34. /* position: relative;
  35. left: 100px;
  36. top: 100px; */
  37. position: absolute;
  38. top: 100px;
  39. z-index:3;
  40. }
  41. .box5 {
  42. margin-top: 15px;
  43. background: pink;
  44. /* position: relative; */
  45. }
  46. .box6 {
  47. margin-top: 15px;
  48. background: #00f;
  49. }
  50. .box7 {
  51. margin-top: 15px;
  52. background: orange;
  53. }
  54. .box8 {
  55. margin-top: 15px;
  56. background: orange;
  57. }
  58. .box9 {
  59. margin-top: 15px;
  60. background: orange;
  61. position: absolute;
  62. top: 100px;
  63. z-index: 99;
  64. }
  65. #box {
  66. width: 800px;
  67. height: 100%;
  68. border: 2px solid #00f;
  69. position: relative;
  70. margin-top: 300px;
  71. background-color: rgb(215, 37, 255);
  72. }