css+js实现拟态中性立体带刻度range范围拖动取值器代码
代码语言:html
所属分类:布局界面
代码描述:css+js实现拟态中性立体带刻度range范围拖动取值器代码
代码标签: css js 拟态 中性 立体 刻度 range 范围 拖动 取值器 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Muli:wght@400;700&display=swap'> <style> * { border: 0; box-sizing: border-box; margin: 0; padding: 0; } :root { --bg: #e3e4e8; --fg: #17181c; --bs1: #ffffff; --bs2: #c1c2c5; --tick: #454954; --transDur: 0.1s; font-size: calc(20px + (40 - 20)*(100vw - 320px)/(2560 - 320)); } body, input { color: var(--fg); font: 1em/1.5 Muli, sans-serif; } body, .range__ticks { display: flex; } body { background-color: var(--bg); display: flex; height: 100vh; } form { margin: auto; max-width: 15em; padding: 0 1.5em; width: 100%; } label { display: block; font-weight: bold; } input[type=range], label { -webkit-tap-highlight-color: transparent; } input[type=range], .range { border-radius: 0.75em; overflow: hidden; margin-bottom: 1.5em; } input[type=range] { background-color: transparent; box-shadow: 0.3em 0.3em 0.4em var(--bs2) inset, -0.3em -0.3em 0.4em var(--bs1) inset; display: block; padding: 0 0.1em; width: 100%; height: 1.5em; -webkit-appearance: none; -moz-appearance: none; appearance: none; } input[type=range]:focus { outline: transparent; } input[type=range]::-webkit-slider-thumb { background-color: #255ff4; border: 0; border-radius: 50%; box-shadow: -0.3em -0.3em 0.5em #0937aa inset, 0 -0.2em 0.2em 0 #0004, 0.3em 0.9em 0.8em #0007; cursor: pointer; position: relative; width: 1.3em; height: 1.3em; transition: all var(--transDur) linear; z-index: 1; -webkit-appearance: none; appearance: none; } input[type=range]:focus::-webkit-slider-thumb { background-color: #5583f6; box-shadow: -0.3em -0.3em 0.5em #0b46da inset, 0 -0.2em 0.2em 0 #0004, 0.3em 0.9em 0.8em #0007; } input[type=range]::-moz-range-thumb { background-color: #255ff4; border: 0; border-radius: 50%; box-shadow: -0.3em -0.3em 0.5em #0937aa inset, 0 -0.2em 0.2em 0 #0004, 0.3em 0.9em 0.8em #0007; cursor: pointer; position: relative; width: 1.3em; height: 1.3em; transform: translateZ(1px); transition: all var(--transDur) linear; z-index: 1; -moz-appearance: none; appearance: none; } input[type=range]:focus::-moz-range-thumb { background-color: #5583f6; box-shadow: -0.3em -0.3em 0.5em #0b46da inset, 0 -0.2em 0.2em 0 #0004, 0.3em 0.9em 0.8em #0007; } input[type=range]::-moz-focus-outer { border: 0; } .range { position: relative; height: 1.5em; } .range__ticks { justify-content: space-between; align-items: center; pointer-events: none; position: absolute; top: 0; left: 0.75em; width: calc(100% - 1.5em); .........完整代码请登录后点击上方下载按钮下载查看
网友评论0