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