6.滑入轮播图.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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: 100px auto;
  19. overflow: hidden;
  20. position: relative;
  21. }
  22. #imgBox {
  23. width: 2950px;
  24. height: 470px;
  25. /* 过渡效果的css3样式属性
  26. 符合输出
  27. property 规定以什么方式去过渡
  28. duration 运动的时间(s/ms)
  29. timing-function 运动的方式
  30. linear 匀速
  31. delay 运动何时开始
  32. */
  33. /* transition: property duration timing-function delay; */
  34. position: absolute;
  35. left: 0;
  36. transition: left 2s linear;
  37. }
  38. /* 解决行内块元素空白间隙问题
  39. 1.让所有行内块元素中间无空格
  40. 2.float 浮动
  41. */
  42. #imgBox img {
  43. float: left;
  44. }
  45. .list {
  46. overflow: hidden;
  47. position: absolute;
  48. bottom: 10px;
  49. right: 10px;
  50. }
  51. .list li {
  52. float: left;
  53. width: 20px;
  54. height: 20px;
  55. background: purple;
  56. color: #fff;
  57. border-radius: 50%;
  58. text-align: center;
  59. line-height: 20px;
  60. font-size: 14px;
  61. margin-left: 10px;
  62. }
  63. #prev,#next {
  64. width: 50px;
  65. height: 50px;
  66. background: rgb(0, 42, 255);
  67. color: #66e21f;
  68. font-size: 30px;
  69. text-align: center;
  70. line-height: 50px;
  71. position: absolute;
  72. top: 50%;
  73. margin-top: -25px;
  74. }
  75. #prev {
  76. left: 0;
  77. }
  78. #next {
  79. right: 0;
  80. }
  81. .list .selected {
  82. background: #f00;
  83. color: #ff0;
  84. }
  85. </style>
  86. </head>
  87. <body>
  88. <div id="container">
  89. <div id="imgBox">
  90. <img src="../image/1.jpg" alt="">
  91. <img src="../image/2.jpg" alt="">
  92. <img src="../image/3.jpg" alt="">
  93. <img src="../image/4.jpg" alt="">
  94. <img src="../image/5.jpg" alt="">
  95. </div>
  96. <ul class="list">
  97. <li class="selected">1</li>
  98. <li>2</li>
  99. <li>3</li>
  100. <li>4</li>
  101. <li>5</li>
  102. </ul>
  103. <div id="prev">
  104. <span>&lt;</span>
  105. </div>
  106. <div id="next">
  107. <span>&gt;</span>
  108. </div>
  109. </div>
  110. <script src="../js/6.滑入轮播图.js"></script>
  111. </body>
  112. </html>