css实现一个无js的幻灯片效果代码
代码语言:html
所属分类:幻灯片
代码描述:css实现一个无js的幻灯片效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link href="https://fonts.googleapis.com/css2?family=DotGothic16&family=Josefin+Sans:wght@300&display=swap" rel="stylesheet"> <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css'> <style> .carousel { margin: auto; width: 50rem; max-width: calc(100% - 6rem); position: relative; border: 2px solid #E6E8E6; position: relative; z-index: 1; } .carousel-num { position: absolute; font-size: 10px; color: #191919; text-shadow: 1px 1px #F15025; width: 100%; bottom: 4px; left: 0; line-height: 2rem; display: flex; z-index: 1; opacity: 0.6; } .carousel-num i { flex: 1; text-align: center; } .carousel-title { font-family: "Josefin Sans", sans-serif; position: absolute; bottom: calc(100% + 8px); left: 0; width: 100%; text-align: center; color: #E6E8E6; text-shadow: 1px 1px #191919; } .carousel-hint { font-family: "DotGothic16", sans-serif; width: 100%; position: absolute; font-size: 12px; line-height: 2rem; color: #E6E8E6; position: absolute; top: calc(100% + 8px); left: 0; display: flex; align-items: center; justify-content: center; -webkit-animation: blink 1s ease infinite; animation: blink 1s ease infinite; text-shadow: 1px 1px #191919; } .carousel-hint i { width: 1rem; height: 1rem; border: 1px solid #F15025; border-radius: 2px; display: grid; place-items: center; margin: 0 8px; } .carousel-stage { width: 100%; aspect-ratio: 16/9; display: flex; overflow-x: scroll; -ms-scroll-snap-type: x mandatory; scroll-snap-type: x mandatory; } .carousel-stage::-webkit-scrollbar { width: 4px; height: 4px; } .carousel-stage::-webkit-scrollbar-track { background-color: #E6E8E6; } .carousel-stage::-webkit-scrollbar-thumb { background-color: #F15025; border-radius: 4px; } .carousel-item { height: 100%; flex: 1 0 100%; scroll-snap-align: start; } .carousel-item:nth-child(odd) { background: red; } .carousel-content { width: 100%; height: 100%; filter: sepia(0.2) brightness(1.15) saturate(1.4); } .carouse.........完整代码请登录后点击上方下载按钮下载查看
网友评论0