简体   繁体   English

使用CSS设置滚动条宽度

[英]Using CSS to set scrollbar Width

I am adding the following CSS style to set the scroll bar width in my DIV element. 我要添加以下CSS样式以在DIV元素中设置滚动条宽度。 My question is in some part of the div tag of the same page, the width is adjusted but in other part, the div tag is wrong. 我的问题是在同一页的div标签的某些部分中,调整了宽度,但在其他部分,div标签是错误的。

Can you please tell me if I do this, if that mean I am setting the scroll bar globally in my whole page. 您能否告诉我是否执行此操作,是否意味着我要在整个页面中全局设置滚动条。 Is this correct? 它是否正确?

::-webkit-scrollbar {
    width: 24px;
}

This sets the scrollbar width: 设置滚动条的宽度:

::-webkit-scrollbar {
  width: 8px;   // for vertical scroll bar
  height: 8px;  // for horizontal scroll bar
}

// for Firefox add this class as well
.thin_scroll{
  scrollbar-width: thin; // auto | thin | none | <length>;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM