Html 在 Internet Explorer 中调整滚动条宽度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23513822/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
resize scroll bar width in internet explorer
提问by jayasiinput
I am new to stackoverflow.
我是 stackoverflow 的新手。
I need to resize the scrollbar width and height.
我需要调整滚动条的宽度和高度。
I tried in many ways, I can get only changing its color but not resizing.
我尝试了很多方法,我只能改变它的颜色而不能调整大小。
回答by Gromo
There is no CSS way to change style of browser scrollbars, except webkit-based browsers (Google Chrome, Safari, new Opera). So to make custom scrollbar you have to emulate it with js. There are lots of jQuery plugins - some better, some worse, some matches your needs, some - not. Try these: jQuery Scrollbar, jScrollPane, Malihu Custom Scrollbar
除了基于 webkit 的浏览器(Google Chrome、Safari、新 Opera)之外,没有 CSS 方法可以更改浏览器滚动条的样式。所以要制作自定义滚动条,你必须用 js 模拟它。有很多 jQuery 插件 - 有些更好,有些更糟,有些符合您的需求,有些则不符合。试试这些:jQuery Scrollbar、jScrollPane、Malihu Custom Scrollbar
回答by Frank
Although this is a fairly old question. MSIE has a feature which allow the scrollbars to hide when not being used. This is very similiar to the scrollbars OSX lion introduced. Plain CSS , NO JS.
虽然这是一个相当古老的问题。MSIE 具有允许滚动条在不使用时隐藏的功能。这与 OSX lion 引入的滚动条非常相似。纯 CSS,无 JS。
body {
scrollbar-base-color: #222;
scrollbar-3dlight-color: #222;
scrollbar-highlight-color: #222;
scrollbar-track-color: #3e3e42;
scrollbar-arrow-color: #111;
scrollbar-shadow-color: #222;
scrollbar-dark-shadow-color: #222;
-ms-overflow-style: -ms-autohiding-scrollbar;
}
The example above shows adding custom scrollbars to MSIE and then having them hidden when out of focus with the -ms-autohiding-scrollbar property.
上面的示例显示了向 MSIE 添加自定义滚动条,然后使用 -ms-autohiding-scrollbar 属性在失焦时隐藏它们。
- Note - you can have different scrollbar behaviors for different parts of your site by targeting and #id or .class instead of body.
- 注意 - 您可以通过定位和 #id 或 .class 而不是正文为网站的不同部分设置不同的滚动条行为。