多个滑动条选项效果

代码语言:html

所属分类:表单美化

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <style>
        * {
            --hl: 0;
            --nothl: calc(1 - var(--hl));
            margin: 0;
            font: inherit;
        }

        body {
            display: grid;
            place-content: center;
            overflow-x: hidden;
            min-height: 100vh;
            background: repeating-linear-gradient(45deg, #ddd, #ddd 5px, transparent 0, transparent 7px) #eee;
        }

        .wrap {
            --w: 20em;
            --h: 1.75em;
            --d: var(--h);
            --r: calc(.5*var(--d));
            --uw: calc(var(--w) - var(--d));
            --dif: calc(var(--max) - var(--min));
            display: grid;
            grid-template-rows: max-content var(--h) max-content;
            grid-gap: .625em;
            overflow: hidden;
            position: relative;
            margin: 1em -1.5em;
            padding: 0 2em;
            width: var(--w);
            font: 700 1.125em ubuntu mono, consolas, monaco, monospace;
        }
        .wrap::before, .wrap::after {
            grid-column: 1;
            grid-row: 2;
            border-radius: var(--r);
            box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.3);
            background: #ccc;
            color: #eee;
            content: "";
        }
        .wrap::after {
            filter: Grayscale(var(--nothl));
            /* non-standard WebKit version */
            -webkit-mask: var(--fill);
            -webkit-mask-composite: xor;
            /* standard version, supported in Firefox */
            mask: var(--fill);
            mask-composite: exclude;
            background: linear-gradient(rgba(255, 255, 255, 0.3), rgba(0, 0, 0, 0.3)) #95a;
            transition: filter 0.3s ease-out;
        }
        .wrap:focus-within {
            --hl: 1;
        }

        .sr-only {
            position: absolute;
            clip-path: inset(50%);
        }

        input[type='range'] {
            grid-column: 1;
            grid-row: 2;
            z-index: calc(1 + var(--hl));
            top: 0;
            left: 0;
            background: none;
            /* get rid of white Chrome background */
            filter: grayScale(var(--nothl));
            transition: filter 0.3s ease-out;
            cursor: grab;
            pointer-events: none;
        }
        input[type='range']::-webkit-slider-runnable-track, input[type='range']::-webkit-slider-thumb, input[type='range'] {
            -webkit-appearance: none;
        }
        input[type='range']::-webkit-slider-runnable-track {
            width: 100%;
            height: 100%;
            background: none;
        }
        input[type='range']::-moz-range-track {
            width: 100%;
            height: 100%;
            background: none;
        }
        input[type='range']::-webkit-slider-thumb {
            box-sizing: border-box;
            /* different between Chrome & Firefox */
            /* box-sizing needed now that we have a non-zero border */
            border: solid calc(.5*var(--r)) transparent;
            width: var(--d);
            height: var(--d);
            border-radius: 50%;
            /* make circular */
            background: linear-gradient(rgba(0, 0, 0, 0.15), rgba(255, 255, 255, 0.2)) content-box, linear-gradient(rgba(255, 255, 255, 0.3), rgba(0, 0, 0, 0.3)) border-box, #f90;
            pointer-events: auto;
        }
        input[type='range']::-moz-range-thumb {
            box-sizing: border-box;
            /* different between Chrome & Firefox */
            /* box-sizing needed now that we have a non-zero border */.........完整代码请登录后点击上方下载按钮下载查看

网友评论0