js+css实现range滑块取值器拖动美化效果代码
代码语言:html
所属分类:表单美化
代码描述:js+css实现range滑块取值器拖动美化效果代码
代码标签: js css range 滑块 取值器 拖动 美化
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { display: flex; flex-direction: column; justify-content: center; align-items: center; row-gap: 2em; min-height: 100vh; background-color: #f2f2f3; font-size: 2em; } .slider-wrapper { --slider-height: .375em; --slider-value: 0; display: flex; align-items: center; position: relative; border-radius: 3.125em; padding: 0.25em; width: 10em; background-image: linear-gradient(to bottom, #cdccd7, #efeef2); box-shadow: 0 1px 1px rgba(255, 255, 255, 0.6); } .slider-wrapper:nth-child(1) { --slider-color: #1664e4; } .slider-wrapper:nth-child(2) { --slider-color: #e5681c; } .slider-track { display: flex; align-items: center; position: relative; border-radius: inherit; height: var(--slider-height); width: calc(100%); background-image: linear-gradient(to bottom, #fff, transparent), linear-gradient(to right, var(--slider-color) 0% calc(var(--slider-value) * 1%), #cccbd2 calc(var(--slider-value) * 1%) 100%); background-blend-mode: overlay, normal; box-shadow: inset 0 0.0625em 0.125em rgba(0, 0, 0, 0.4); } .slider-input { -moz-appearance: none; -webkit-appearance: none; appearance: none; position: absolute; z-index: 1; top: 0; left: 50%; transform: translate(-50%); border-radius: inherit; width: calc(100% + .875em); height: 100%; opacity: 0; cursor: pointer; } .slider-input::-webkit-slider-thumb { -moz-appearance: none; -webkit-appearance: none; appearance: none; border-radius: 50%; padding: 0.5em; width: 1.25em; height: 1.25em; } .slider-input::-moz-range-thumb { -moz-appearance: none; -webkit-appearance: none; appearance: none; border-radius: 50%; padding: 0.5em; width: 1.25em; heigh.........完整代码请登录后点击上方下载按钮下载查看
网友评论0