css中的滚动条拇指高度 [英] Scrollbar thumb height in css

查看:40
本文介绍了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.

推荐答案

我不这么认为,thumb 的高度是根据内容的大小来决定的,你可以在 ::- 里面改变宽度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天全站免登陆