carousel.css 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. * {
  2. margin: 0;
  3. padding: 0;
  4. }
  5. @media screen and (max-width: 768px) and (min-width: 200px) {
  6. div img{
  7. max-width: 100%;
  8. }
  9. /*banner区域 end*/
  10. .carousel a {
  11. list-style: none;
  12. }
  13. .carousel li {
  14. list-style: none;
  15. display: flex;
  16. width: 100%;
  17. justify-content: center;
  18. align-items: center;
  19. }
  20. .carousel {
  21. width: 100%;
  22. }
  23. .carousel .content {
  24. height: 300px;
  25. margin: 0 auto 0;
  26. position: relative;
  27. }
  28. .carousel #item {
  29. width: 100%;
  30. height: 100%;
  31. }
  32. .carousel .item {
  33. width: 100%;
  34. position: absolute;
  35. opacity: 0;
  36. transition: all 1s;
  37. overflow: hidden;
  38. }
  39. .carousel .item.active {
  40. opacity: 1;
  41. }
  42. .carousel img {
  43. /*width: 100%;*/
  44. height: 300px;
  45. }
  46. .carousel #btn-left {
  47. display: none;
  48. width: 30px;
  49. height: 69px;
  50. font-size: 30px;
  51. color: white;
  52. box-shadow: white 0 0 5px;
  53. background-color: rgba(0, 0, 0, 0.65);
  54. line-height: 69px;
  55. padding-left: 5px;
  56. z-index: 10; /*始终显示在图片的上层*/
  57. position: absolute;
  58. left: 40px;
  59. top: 50%;
  60. transform: translateY(-60%); /*使按钮向上偏移居中对齐*/
  61. cursor: pointer;
  62. user-select: none;
  63. border-radius: 8px;
  64. transition: opacity 0.3s ease-in-out, background-color 0.3s ease-in-out;
  65. }
  66. #btn-left:hover {
  67. background-color: rgba(0, 0, 0, 0.65);
  68. }
  69. .carousel #btn-right {
  70. display: none;
  71. border-radius: 8px;
  72. user-select: none;
  73. width: 26px;
  74. height: 69px;
  75. font-size: 30px;
  76. color: white;
  77. box-shadow: white 0 0 5px;
  78. background-color: rgba(0, 0, 0, 0.65);
  79. line-height: 69px;
  80. padding-left: 5px;
  81. z-index: 10;
  82. position: absolute;
  83. right: 40px;
  84. top: 50%;
  85. cursor: pointer;
  86. transform: translateY(-60%);
  87. transition: opacity 0.3s ease-in-out, background-color 0.3s ease-in-out;
  88. }
  89. .carousel #circle {
  90. height: 20px;
  91. display: flex;
  92. position: absolute;
  93. bottom: 5px;
  94. left: calc(50% - 50px);
  95. align-items: center;
  96. padding-bottom: 1px;
  97. border-radius: 10px;
  98. }
  99. .carousel .circle {
  100. width: 10px;
  101. height: 10px;
  102. border-radius: 10px;
  103. /*border: 2px solid white;*/
  104. background: rgba(0, 0, 0, 0.4);
  105. box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  106. cursor: pointer;
  107. margin: 5px;
  108. }
  109. .carousel .white {
  110. background-color: #FFFFFF;
  111. }
  112. }
  113. @media all and (min-width: 768px) {
  114. .carousel a {
  115. list-style: none;
  116. }
  117. .carousel li {
  118. list-style: none;
  119. display: flex;
  120. width: 100%;
  121. justify-content: center;
  122. align-items: center;
  123. }
  124. .carousel {
  125. width: 100%;
  126. }
  127. .carousel .content {
  128. height: 300px;
  129. margin: 0 auto 0;
  130. position: relative;
  131. }
  132. .carousel #item {
  133. width: 100%;
  134. height: 100%;
  135. }
  136. .carousel .item {
  137. width: 100%;
  138. position: absolute;
  139. opacity: 0;
  140. transition: all 1s;
  141. overflow: hidden;
  142. }
  143. .carousel .item.active {
  144. opacity: 1;
  145. }
  146. .carousel img {
  147. /*width: 100%;*/
  148. height: 300px;
  149. }
  150. .carousel #btn-left {
  151. width: 30px;
  152. height: 69px;
  153. font-size: 30px;
  154. color: white;
  155. background-color: rgba(0, 0, 0, 0.4);
  156. line-height: 69px;
  157. padding-left: 5px;
  158. z-index: 10; /*始终显示在图片的上层*/
  159. position: absolute;
  160. left: 40px;
  161. top: 50%;
  162. transform: translateY(-60%); /*使按钮向上偏移居中对齐*/
  163. cursor: pointer;
  164. opacity: 0; /*平时隐藏*/
  165. user-select: none;
  166. border-radius: 8px;
  167. transition: opacity 0.3s ease-in-out, background-color 0.3s ease-in-out;
  168. }
  169. .carousel:hover #btn-left {
  170. /*鼠标滑入,显示图标*/
  171. opacity: 1;
  172. }
  173. #btn-left:hover {
  174. background-color: rgba(0, 0, 0, 0.65);
  175. }
  176. .carousel #btn-right {
  177. border-radius: 8px;
  178. user-select: none;
  179. width: 26px;
  180. height: 69px;
  181. font-size: 30px;
  182. color: white;
  183. background-color: rgba(0, 0, 0, 0.4);
  184. line-height: 69px;
  185. padding-left: 5px;
  186. z-index: 10;
  187. position: absolute;
  188. right: 40px;
  189. top: 50%;
  190. cursor: pointer;
  191. opacity: 0;
  192. transform: translateY(-60%);
  193. transition: opacity 0.3s ease-in-out, background-color 0.3s ease-in-out;
  194. }
  195. .carousel:hover #btn-right {
  196. opacity: 1;
  197. }
  198. #btn-right:hover {
  199. background-color: rgba(0, 0, 0, 0.65);
  200. }
  201. .carousel #circle {
  202. height: 20px;
  203. display: flex;
  204. position: absolute;
  205. bottom: 5px;
  206. left: calc(50% - 50px);
  207. align-items: center;
  208. padding-bottom: 1px;
  209. border-radius: 10px;
  210. }
  211. .carousel .circle {
  212. width: 10px;
  213. height: 10px;
  214. border-radius: 10px;
  215. /*border: 2px solid white;*/
  216. background: rgba(0, 0, 0, 0.4);
  217. box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  218. cursor: pointer;
  219. margin: 5px;
  220. }
  221. .carousel .white {
  222. background-color: #FFFFFF;
  223. }
  224. }