css+js实现多色胶囊立体滑块拖动效果代码
代码语言:html
所属分类:拖放
代码描述:css+js实现多色胶囊立体滑块拖动效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<html> <head> <style> * { border: 0; box-sizing: border-box; margin: 0; padding: 0; } :root { --bg: hsl(223,10%,90%); --fg: hsl(223,10%,10%); --orange: hsl(29,90%,55%); --yellow: hsl(43,90%,55%); --blue: hsl(198,90%,55%); --white: hsl(223,10%,100%); font-size: calc(20px + (30 - 20) * (100vw - 320px) / (1280 - 320)); } body, input { font: 1em/1.5 "Jost", system-ui, -apple-system, sans-serif; } body { background: #282828; color: var(--fg); display: flex; height: 100vh; } form { display: grid; grid-gap: 0 1.5em; grid-template-columns: repeat(2, 1fr); margin: auto; } label { display: block;color: #fff; } .range-pill { --pillWidth: 4.5em; box-shadow: 0 0.375em 0.375em 0 rgba(0, 0, 0, 0.3); display: inline-block; overflow: hidden; position: relative; width: var(--pillWidth); height: 1.5em; } .range-pill, .range-pill:before, .range-pill__input { border-radius: 0.75em; } .range-pill:before, .range-pill:after, .range-pill__fill, .range-pill__input, .range-pill__value { display: block; position: absolute; } .range-pill:before, .range-pill__fill, .range-pill__input, .range-pill__value { top: 0; left: 0; height: 100%; } .range-pill:before, .range-pill__input, .range-pill__value { width: 100%; } .range-pill:before, .range-pill:after { content: ""; z-index: 3; } .range-pill:before { background: radial-gradient(0.5em 0.4em at 0.75em 0.5em, rgba(255, 255, 255, 0.25) 30%, rgba(255, 255, 255, 0) 50%); box-shadow: 0.05em -0.025em 0.25em 0.05em rgba(255, 255, 255, 0.4) inset, 0.125em -0.125em 0.15em 0.25em rgba(255, 255, 255, 0.07) inset, 0 -0.75em 0.175em 0 rgba(0, 0, 0, 0.07) inset, 0 -0.4em 0.05em 0.2em rgba(255, 255, 255, 0.07) inset, 0 -0.125em 0.05em 0.2em rgba(255, 255, 255, 0.1) inset; } .range-pill:after { background: rgba(255, 255,.........完整代码请登录后点击上方下载按钮下载查看
网友评论0