增加Firefox中的滚动条宽度 - html / css

时间:2014-03-07 07:21:04

标签: javascript jquery html css firefox

我看到了一些有关此问题的问题,但这些问题没有给出适合我的解决方案。

我想增加div的滚动条宽度。 div大小很大,所以出现了一个水平滚动条。现在我想增加滚动条的宽度以获得更大的灵活性。 所以我搜索并找到以下链接,其代码适用于Chrome浏览器。 JSFiddle

::-webkit-scrollbar {
    width: 2em;
    height: 2em
}
::-webkit-scrollbar-button {
    background: #ccc
}

但这对Firefox不起作用。我尝试用 moz 替换 webkit ,但也没有。

我还发现在firefox的userContent.css文件中编写以下代码可以增加滚动条宽度,但1)我在Windows 7中找不到 userContent.css 文件.2)我不能去用户'回家告诉他们如何手动增加滚动条宽度:P那不是解决方案。

/* Increase width of VERTICAL SCROLLBAR */
scrollbar[orient="vertical"], scrollbar[orient="vertical"] thumb, scrollbar[orient="vertical"] scrollbarbutton { min-width: 35px !important; -moz-appearance: none !important; }

/* Increase width of HORIZONTAL SCROLLBAR */
scrollbar[orient="horizontal"], scrollbar[orient="horizontal"] thumb, scrollbar[orient="horizontal"] scrollbarbutton { min-height: 35px !important; -moz-appearance: none !important; }

有什么方法可以增加Chrome和&amp ;;中的滚动条宽度火狐? (忘记IE)我可以使用 html css javascript& jquery 解决方案,但没有滚动条插件。我已从浏览器转换原生滚动条。

3 个答案:

答案 0 :(得分:1)

检查以下链接。查看网站上提到的philipp评论。

https://support.mozilla.org/en-US/questions/979461也查看bugZilla

https://bugzilla.mozilla.org/show_bug.cgi?id=77790

别忘了查看评论#134

Custom CSS Scrollbar for Firefox

答案 1 :(得分:0)

尽管chrome支持使用-webkit前缀更改滚动条宽度,但其他浏览器都不支持。有些允许滚动条的样式,所以颜色不同,但据我所知,你不能改变宽度。

相反,如果您更改滚动条绝对必要,则需要使用JavaScript解决方案。

有很多解决方案 - 在SO的答案中记录太多 - 但这里有一些链接可以帮助你入门:

答案 2 :(得分:0)

虽然你不能关闭FF的CSS ..你可以使用这个插件:http://manos.malihu.gr/tuts/m-custom-scrollbar-plugin.zip