<input type=“range”> style not applies to thumb when it is vertical

前端 未结 1 344
旧巷少年郎
旧巷少年郎 2021-01-23 06:47

i am creating vertical range bar and i changed the -webkit-appearance : slider-vertical.

I also changed the input-range bar\'s properties s

相关标签:
1条回答
  • 2021-01-23 07:24

    I afraid it's not possible. See [Google chrome vertical <input type="range" /> ] for more info.

    But there is a nice trick. https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/#comment-1586472

    input[type=range][orient=vertical] {
        -webkit-appearance: none;
        /*-webkit-appearance: slider-vertical; /*if we remove this slider-vertical then horizondally range bar styles applies correctly*/
        width: 10%;
        height: 40%;
        transform: translateY(30px) rotate(90deg);
        transform-origin:bottom;  
    }
    
    input[type=range][orient=vertical]::-webkit-slider-runnable-track {
        background: yellow;  
        border: 1px solid black; 
    }
    
    input[type=range]::-webkit-slider-thumb {
        -webkit-appearance: none;
        border: none;
        height: 16px;
        width: 16px;
        border-radius: 50%;
        background: goldenrod;
        margin-top: -4px;
    }
    <input type="range" orient="vertical" />

    0 讨论(0)
提交回复
热议问题