【问题标题】:Input-type range with custom css - thumb not showing correct in IE具有自定义 css 的输入类型范围 - 拇指在 IE 中显示不正确
【发布时间】:2016-01-28 10:42:35
【问题描述】:

我的网页在 IE 以外的所有其他浏览器中看起来都不错。在这里,我的范围滑块的拇指被“切断”了。

我的代码在这里:

https://jsfiddle.net/t1pw9rh2/

HTML:

<form action="url-link-here" method="post">

<span id="mydiv">100</span>

<input class="input-range" id="sizeID" onchange="test()" oninput="test()" type="range" name="size" value="100" min="5" max="250" step ="5">

</form>

CSS:

input[type=range] {
  -webkit-appearance: none;
  margin: 10px 0;
  width: 100%;
}
input[type=range]:focus {
  outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 10px;
  cursor: pointer;
  animate: 0.2s;
  box-shadow: 0px 0px 0px #000000;
  background: #fff;
  border-radius: 1px;
  border: 1px solid #39404D;
}
input[type=range]::-webkit-slider-thumb {
  box-shadow: 0px 0px 0px #000000;
  border: 1px solid #39404D;
  height: 28px;
  width: 16px;
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -10px;
}
input[type=range]:focus::-webkit-slider-runnable-track {
  background: #fff;
}
input[type=range]::-moz-range-track {
  width: 100%;
  height: 10px;
  cursor: pointer;
  animate: 0.2s;
  box-shadow: 0px 0px 0px #000000;
  background: #fff;
  border-radius: 1px;
  border: 1px solid #39404D;
}
input[type=range]::-moz-range-thumb {
  box-shadow: 0px 0px 0px #000000;
  border: 1px solid #39404D;
  height: 28px;
  width: 16px;
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
}
input[type=range]::-ms-track {
  width: 100%;
  height: 10px;
  cursor: pointer;
  animate: 0.2s;
  background: transparent;
  border-color: transparent;
  color: transparent;
}
input[type=range]::-ms-fill-lower {
  background: #fff;
  border: 1px solid #39404D;
  border-radius: 4px;
  box-shadow: 0px 0px 0px #000000;
}
input[type=range]::-ms-fill-upper {
  background: #fff;
  border: 1px solid #39404D;
  border-radius: 4px;
  box-shadow: 0px 0px 0px #000000;
}
input[type=range]::-ms-thumb {
  box-shadow: 0px 0px 0px #000000;
  border: 1px solid #39404D;
  height: 28px;
  width: 16px;
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
}
input[type=range]:focus::-ms-fill-lower {
  background: #fff;
}
input[type=range]:focus::-ms-fill-upper {
  background: #fff;
}

Javascript:

function test(){
var myDivElem = document.getElementById("mydiv");
var sizerange= document.getElementById("sizeID");
myDivElem.innerHTML = sizerange.value;
}

我的网页可以在这里看到:

http://negoto.azurewebsites.net/

如何修复 css 以使拇指在 IE 中看起来不错?

最好的,彼得

【问题讨论】:

    标签: html css internet-explorer input range


    【解决方案1】:

    我在这里找到了答案。 http://brennaobrien.com/blog/2014/05/style-input-type-range-in-every-browser.html 它提到你不能在 IE 中设置比轨道更大的拇指样式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-05
      • 1970-01-01
      相关资源
      最近更新 更多