Google chrome vertical <input type=“range” />

前端 未结 5 1074
轮回少年
轮回少年 2020-12-20 22:20

On opera, i can do the following




相关标签:
5条回答
  • 2020-12-20 22:53

    Maybe with a css transform ?

    -webkit-transform: rotate(90);
    

    Another solution could be to use the slider module from jQuery UI.
    http://jqueryui.com/demos/slider/#slider-vertical

    0 讨论(0)
  • 2020-12-20 22:55
    input[type='range']{        
        width:20px;
        height:140px;
        border:2px solid blue;
        display:block;
        -webkit-transform:rotate(90deg); /* Safari and Chrome */        
        -moz-transform:rotate(90deg);
        -o-transform:rotate(90deg);
        -ms-transform:rotate(90deg);
        transform:rotate(90deg);
        z-index: 0; 
    }
    
    0 讨论(0)
  • 2020-12-20 22:56

    -webkit-appearance: slider-vertical;

    0 讨论(0)
  • 2020-12-20 23:09

    As Aron has said there is no support for webkit browser.

    However this is what i could do for achieving the output.

    body {
      margin: 50px;
    }
    .opacitySlider {
      position: relative;
      transform: rotate(90deg);
      width: 125px;
      height: 20px;
    }
    .opacitySlider:before {
      content: " ";
      left: 10px;
      top: 1px;
      position: absolute;
      border-top: 9px solid transparent;
      border-bottom: 9px solid transparent;
      border-left: 115px solid #ccc;
    }
    .opacitySlider input[type=range] {
      outline: none;
      -webkit-appearance: none;
      height: 20px;
      padding: 0;
      width: 125px;
      background: transparent;
      position: relative;
      margin: 0;
      cursor: pointer;
    }
    .opacitySlider input[type=range]::-webkit-slider-thumb {
      -webkit-appearance: none;
      background: #69a80e;
      height: 20px;
      width: 20px;
      border: 1px solid #fff;
      border-radius: 50%;
    }
    .opacitySlider input[type=range]::-moz-range-track {
      border: none;
      background-color: transparent;
    }
    .opacitySlider input[type=range]::-moz-range-thumb {
      background: #69a80e;
      height: 20px;
      width: 20px;
      border: 1px solid #fff;
      border-radius: 50%;
    }
    .opacitySlider input[type=range]::-ms-fill-lower, .opacitySlider input[type=range]::-ms-fill-upper {
      background: transparent;
    }
    .opacitySlider input[type=range]::-ms-track {
      height: 18px;
      border: none;
      background-color: transparent;
      margin: 0;
    }
    .opacitySlider input[type=range]::-ms-thumb {
      background: #69a80e;
      height: 20px;
      width: 20px;
      border: 1px solid #fff;
      border-radius: 50%;
      height: 17px;
      width: 17px;
    }
    <div class="opacitySlider">
      <input step="any" type="range">
    </div>

    0 讨论(0)
  • 2020-12-20 23:12

    It seems Chromium does not yet implement support for this yet:

    See: http://www.chromium.org/developers/web-platform-status/forms

    Not available yet

    • Localization of
    • Dedicated UIs for color, date, datetime, datetime-local, month, time, and week types
    • Automatic switching to vertical range
    • Value sanitization algorithms
    • datalist element, list attribute, and list/selectedOption properties

    Edit: Vuurwerk indicated that it is actually possible to alter the presentation using the -webkit-appearance: slider-vertical property. Although this does transform it into a vertical slider, I would not recommend doing this, since it will break your layout and doesn't look really pretty: example.

    If you really want a vertical slider, use a JavaScript solution. Support for <input type="range" /> is very basic at the moment anyway, so you are probably better off with a graceful degradation or progressive enhancement approach.

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