【发布时间】:2019-08-30 22:29:41
【问题描述】:
所以我正在为广播电台创建一个网站,但遇到了一个问题。我们用于音量的范围输入实际上拒绝更改其背景颜色和高度。为了这个项目的目的,我正在使用 SASS(使其成为 scss 文件类型)。
我进行了一些研究,并尝试了一些互联网推荐的方法,但不幸的是,没有一个奏效。我尝试使用background、background-color 甚至color 字段来尝试解决我的问题。通过将-webkit-appearance 设置为none,我确保覆盖所有可能阻止我这样做的内容。
这是我的 hbs 文件中滑块及其父元素的内容:
<div class="rootplayer">
<div>
<img class="picture" alt='Artist art' src="{{songart}}" width="170px">
<div class="playerinfo">
<p>On air: {{dj}}</p>
<hr>
<p>Up next: AJS Show</p>
<hr>
<p>Currently playing: {{songTitle}}</p>
<hr>
<p>Current Listeners: {{currentListeners}}</p>
</div>
<audio controls="" id="player">
<source src="http://radio.nowhits.uk:8000/radio.mp3" type="audio/mpeg">
<p>Your browser does not support the audio element.</p>
</audio>
</div>
<div class="playercontrols">
<i class="fas fa-play" onclick="play()" id="play"></i>
<i class="fas fa-pause" onclick="pause()" id="pause"></i>
<input type="range" min="0" max="1" value="0.5" step="0.01" class="slider" id="volume">
<script src="scripts/volume.js"></script>
<script src="scripts/playpause.js"></script>
</div>
</div>
这是我的 scss 文件中滑块对象的内容:
.slider {
-webkit-appearance: none;
height: 1px;
width: 65%;
background-color: red;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
cursor: pointer;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 12px;
height: 12px;
background: #000;
border-radius: 50%;
}
.slider::-moz-range-thumb {
width: 12px;
height: 12px;
background: #000;
cursor: pointer;
border-radius: 50%;
}
显然,预期的输出应该是红色背景和 1px 的高度(应该是一条非常细的线),但我得到的是 this。
【问题讨论】:
-
您使用哪种浏览器?我在 chrome 中尝试了您的代码,将
height更改为1px并且效果很好。 -
@ItzhakAvraham 很有意思,我也用 Chrome... 说说你用的是什么,你用的是原版 css 还是 (node-)sass 文章中提到的?
-
当然,我用的是scss(你的代码是scss而不是sass,有区别)。您使用的是 chrome,因为范围输入看起来与您附加的图片不同。为什么范围调谐器在你的图片中是一个圆圈?
-
这就是原因,我没有在问题中包含这个,因为这是我问的问题,差别不大,但我们开始了(再次查看帖子,我已经添加了样式对于滑块拇指)