* { margin: 0; padding: 0; } @media screen and (max-width: 768px) and (min-width: 200px) { div img{ max-width: 100%; } /*banner区域 end*/ .carousel a { list-style: none; } .carousel li { list-style: none; display: flex; width: 100%; justify-content: center; align-items: center; } .carousel { width: 100%; } .carousel .content { height: 300px; margin: 0 auto 0; position: relative; } .carousel #item { width: 100%; height: 100%; } .carousel .item { width: 100%; position: absolute; opacity: 0; transition: all 1s; overflow: hidden; } .carousel .item.active { opacity: 1; } .carousel img { /*width: 100%;*/ height: 300px; } .carousel #btn-left { display: none; width: 30px; height: 69px; font-size: 30px; color: white; box-shadow: white 0 0 5px; background-color: rgba(0, 0, 0, 0.65); line-height: 69px; padding-left: 5px; z-index: 10; /*始终显示在图片的上层*/ position: absolute; left: 40px; top: 50%; transform: translateY(-60%); /*使按钮向上偏移居中对齐*/ cursor: pointer; user-select: none; border-radius: 8px; transition: opacity 0.3s ease-in-out, background-color 0.3s ease-in-out; } #btn-left:hover { background-color: rgba(0, 0, 0, 0.65); } .carousel #btn-right { display: none; border-radius: 8px; user-select: none; width: 26px; height: 69px; font-size: 30px; color: white; box-shadow: white 0 0 5px; background-color: rgba(0, 0, 0, 0.65); line-height: 69px; padding-left: 5px; z-index: 10; position: absolute; right: 40px; top: 50%; cursor: pointer; transform: translateY(-60%); transition: opacity 0.3s ease-in-out, background-color 0.3s ease-in-out; } .carousel #circle { height: 20px; display: flex; position: absolute; bottom: 5px; left: calc(50% - 50px); align-items: center; padding-bottom: 1px; border-radius: 10px; } .carousel .circle { width: 10px; height: 10px; border-radius: 10px; /*border: 2px solid white;*/ background: rgba(0, 0, 0, 0.4); box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); cursor: pointer; margin: 5px; } .carousel .white { background-color: #FFFFFF; } } @media all and (min-width: 768px) { .carousel a { list-style: none; } .carousel li { list-style: none; display: flex; width: 100%; justify-content: center; align-items: center; } .carousel { width: 100%; } .carousel .content { height: 300px; margin: 0 auto 0; position: relative; } .carousel #item { width: 100%; height: 100%; } .carousel .item { width: 100%; position: absolute; opacity: 0; transition: all 1s; overflow: hidden; } .carousel .item.active { opacity: 1; } .carousel img { /*width: 100%;*/ height: 300px; } .carousel #btn-left { width: 30px; height: 69px; font-size: 30px; color: white; background-color: rgba(0, 0, 0, 0.4); line-height: 69px; padding-left: 5px; z-index: 10; /*始终显示在图片的上层*/ position: absolute; left: 40px; top: 50%; transform: translateY(-60%); /*使按钮向上偏移居中对齐*/ cursor: pointer; opacity: 0; /*平时隐藏*/ user-select: none; border-radius: 8px; transition: opacity 0.3s ease-in-out, background-color 0.3s ease-in-out; } .carousel:hover #btn-left { /*鼠标滑入,显示图标*/ opacity: 1; } #btn-left:hover { background-color: rgba(0, 0, 0, 0.65); } .carousel #btn-right { border-radius: 8px; user-select: none; width: 26px; height: 69px; font-size: 30px; color: white; background-color: rgba(0, 0, 0, 0.4); line-height: 69px; padding-left: 5px; z-index: 10; position: absolute; right: 40px; top: 50%; cursor: pointer; opacity: 0; transform: translateY(-60%); transition: opacity 0.3s ease-in-out, background-color 0.3s ease-in-out; } .carousel:hover #btn-right { opacity: 1; } #btn-right:hover { background-color: rgba(0, 0, 0, 0.65); } .carousel #circle { height: 20px; display: flex; position: absolute; bottom: 5px; left: calc(50% - 50px); align-items: center; padding-bottom: 1px; border-radius: 10px; } .carousel .circle { width: 10px; height: 10px; border-radius: 10px; /*border: 2px solid white;*/ background: rgba(0, 0, 0, 0.4); box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); cursor: pointer; margin: 5px; } .carousel .white { background-color: #FFFFFF; } }