小编Pin*_*nci的帖子

如何设置输入类型=“范围”的样式

我在设计这个元素时有点挣扎。我以前从未这样做过,我无法真正找到解决问题的方法。

我只想向边缘添加边框半径,向该点添加一些框阴影,这是可拖动的,我问的主要原因是,如何将较低的不透明度添加到尚未选择的一侧。

我不知道它是否必须由 Javascript 完成,或者我可以简单地用 css 来完成,但我的问题是:

这就是我的范围现在的样子

在此处输入图片说明

我的目标是这个

在此处输入图片说明

因为我以前从未设计过这个元素的样式,所以所有这些 css 都来自我在 Google 上找到的多篇文章。有没有像background:active和background:unactive 这样的东西?

谢谢。

.container{
  background-color:red;
  width:30%;
  padding:1em;
  text-align:center;
}

input[type="range"]{
    width: 100%;
}

input[type=range]{
    -webkit-appearance: none;
}

input[type=range]::-webkit-slider-runnable-track {
    height: .35em;
    background: white;
    border: none;
    border-radius: 3px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    border: none;
    height: 1.1em;
    width: 1.1em;
    border-radius: 50%;
    background: white;
    margin-top: -4px;
}

input[type=range]:focus {
    outline: none;
}
Run Code Online (Sandbox Code Playgroud)
<div class="container">
  <div className="range">
      <p className="heading">HEIGHT</p>
       <input …
Run Code Online (Sandbox Code Playgroud)

html css input

11
推荐指数
1
解决办法
8969
查看次数

标签 统计

css ×1

html ×1

input ×1