9.轮播.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. * {
  9. margin: 0;
  10. padding: 0;
  11. list-style: none;
  12. text-decoration: none;
  13. box-sizing: border-box;
  14. }
  15. #container {
  16. width: 590px;
  17. height: 470px;
  18. position: relative;
  19. margin: 200px auto;
  20. }
  21. .pictures {
  22. width: 100%;
  23. height: 100%;
  24. display: none;
  25. }
  26. .choose {
  27. display: block;
  28. }
  29. #list {
  30. overflow: hidden;
  31. position: absolute;
  32. bottom: 5px;
  33. right: 10px;
  34. }
  35. #list li{
  36. width: 30px;
  37. height: 30px;
  38. color: #fff;
  39. text-align: center;
  40. line-height: 30px;
  41. border-radius: 50%;
  42. background: #00f;
  43. float: left;
  44. margin-left: 8px;
  45. }
  46. .active {
  47. color: #ff0 !important;
  48. background: #f00 !important;
  49. }
  50. #prev,#next {
  51. width: 60px;
  52. height: 40px;
  53. color: #fff;
  54. text-align: center;
  55. line-height: 40px;
  56. background: purple;
  57. display: none;
  58. }
  59. #prev {
  60. position: absolute;
  61. left: 0;
  62. top: 45%;
  63. }
  64. #next {
  65. position: absolute;
  66. right: 0;
  67. top: 45%;
  68. }
  69. </style>
  70. </head>
  71. <body>
  72. <div id="container">
  73. <div id="imgBox">
  74. <img class="pictures choose" src="./images/1.jpg" alt="">
  75. <img class="pictures" src="./images/2.jpg" alt="">
  76. <img class="pictures" src="./images/3.jpg" alt="">
  77. <img class="pictures" src="./images/4.jpg" alt="">
  78. <img class="pictures" src="./images/5.jpg" alt="">
  79. </div>
  80. <ul id="list">
  81. <li class="active">1</li>
  82. <li>2</li>
  83. <li>3</li>
  84. <li>4</li>
  85. <li>5</li>
  86. </ul>
  87. <div id="prev"><span>&lt;</span></div>
  88. <div id="next"><span>&gt;</span></div>
  89. </div>
  90. <script src="./9.轮播.js"></script>
  91. </body>
  92. </html>