滚动条拇指高度(css) [英] Scrollbar thumb height in css

查看:177
本文介绍了滚动条拇指高度(css)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否根据可滚动区域将滚动拇指的高度设置为默认值?如果没有,我可以设置滚动条的拇指高度吗?如果有可能怎么办?我尝试通过以下方式进行操作.

Is the height of scroll thumb set as default according to scroll-able area? If not, can I set scrollbar thumb height? If it is possible how? I tried to do it the following way.

body::-webkit-scrollbar-thumb {
  background-color: darkgrey;
  outline: 1px solid slategrey;
  height: 5px;
}

但是它对页面没有影响.请帮忙.预先感谢.

But it have no impact on the page. Please help. Thanks in advance.

推荐答案

我不这样认为,拇指的高度取决于内容的大小,您可以更改::-webkit-scrollbar内的宽度,但可以改变高度将始终基于内容.

I don't think so, the height of the thumb is based in the size of content, you can change the width inside the ::-webkit-scrollbar but the height will always be based on the content.

::-webkit-scrollbar              { /* 1 */ }
::-webkit-scrollbar-button       { /* 2 */ }
::-webkit-scrollbar-track        { /* 3 */ }
::-webkit-scrollbar-track-piece  { /* 4 */ }
::-webkit-scrollbar-thumb        { /* 5 */ }
::-webkit-scrollbar-corner       { /* 6 */ }
::-webkit-resizer                { /* 7 */ }

来源

这篇关于滚动条拇指高度(css)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆