练习12_定位练习.html 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <style>
  8. body{
  9. background-color: #f0f4c3;
  10. }
  11. .content{
  12. width: 600px;
  13. height: 600px;
  14. background-color: #fff;
  15. position: absolute;
  16. top: 50%;
  17. left: 50%;
  18. margin-top: -300px;
  19. margin-left: -300px;
  20. border-radius: 20px;
  21. box-shadow: 0 0 10px rgba(0,0,0,0.5);
  22. padding-top: 20px;
  23. }
  24. .content-info h1{
  25. text-align: center;
  26. color: #689f38;
  27. }
  28. .content-info .info-center{
  29. width: 300px;
  30. margin: 0 auto;
  31. text-align: center;
  32. }
  33. .content-info .info-bottom{
  34. text-align: center;
  35. color: #999;
  36. font-size: 12px;
  37. }
  38. </style>
  39. </head>
  40. <body>
  41. <div class="container">
  42. <div class="content">
  43. <div class="content-info">
  44. <h1>趣味气泡 Position 练习</h1>
  45. <p class="info-center"><strong>任务:</strong> 观察并理解气泡的定位方式,鼠标悬停气泡试试看!</p>
  46. <p class="info-bottom">(气泡用 absolute,气泡区用 relative,底部说明条用 fixed)</p>
  47. </div>
  48. <div class="content-bubble"></div>
  49. </div>
  50. <div class="footer"></div>
  51. </div>
  52. </body>
  53. </html>