7.轮播.html 2.3 KB

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