css - 输入范围处理程序不会在 Chrome 中呈现

标签 css html google-chrome safari webkit

我正在开发一种在网站上预览字体的工具。对于这个工具,我想使用 <input type="range" />更改文本区域中的字体大小。因为我不喜欢 slider 和处理程序的默认 WebKit 渲染,所以我使用 CSS 自定义了它们。虽然该页面在 Safari 中呈现良好,但 Chrome 不显示 slider 句柄(但其他网站上的 slider 呈现良好)。我必须更改什么才能使其在 Chrome 中也能正常工作?

HTML

<input type="range" min="6" max="70" value="22" id="font-1-size" />

CSS

.tester-option.font-size input
{
    -webkit-appearance: none !important;
    background: #cecece;
    height: 1px;
    width: 425px;
    -webkit-transform: translate3d(0px, 0px, 0px);
    margin-top: 10px;
    cursor: pointer;
}

.tester-option.font-size input::-webkit-slider-thumb
{
    -webkit-appearance: none !important;
    background: #666;
    height: 10px;
    width: 10px;
    cursor: pointer;
    -moz-border-radius: 10px;
    border-radius: 10px;
}

您可以在此处找到实际示例:http://fishnation.de/development/26plus/#test-font render differences safari and chrome

附言我知道有 jQuery UI,但我想替换尽可能少的元素。

最佳答案

尝试更改您的选择器。我使用了 #font-1-size::-webkit-slider-thumb。这在 Chrome 中运行良好。

关于css - 输入范围处理程序不会在 Chrome 中呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6012822/

相关文章:

php - 在 firefox 错误中下载 csv 文件

python - Selenium 和 Chrome - sendkeys 不起作用

css - 使用 <p :rowToggler/> with Text as Label instead Symbol of toggler

html - 当我将 <span> 更改为 <div> 时,文本消失了

javascript - 选择悬停时触发 Bootstrap 弹出窗口

html - 如何在现有网站/导航上创建下拉菜单?

google-chrome - 谷歌浏览器 : automatically "Reveal in navigator"

html - 而不是设置高度:100%; can I just go height:2000px;

php - 如果页面上存在 DIV,则无法隐藏 PHP 脚本

asp.net-mvc - 验证(HTML5) : Element 'T' is not supported