设置为固定:webkit滚动条拇指大小(长度/高度)

时间:2016-11-02 20:08:26

标签: html css css3 webkit scrollbar

ul的{​​{1}}从height改为300px。 ul设置为900px,每当overflow-y: scroll的高度增加时,ulscrollbar track都会随之调整大小。

无论scrollbar thumbscrollbar thumb如何,您如何将 ul 设置为固定尺寸​​(高度)调整大小?

我尝试添加到scrollbar track,但没有成功。

请查看关于问题的图片

-webkit-scrollbar-thumb

enter image description here enter image description here

1 个答案:

答案 0 :(得分:0)

您的问题可能会迟到,但是当我意外地登陆此页面时,回复此内容可能会对其他人有所帮助,请参阅此link

<div class="visible-scrollbar">Thisisaveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylongword</div>
<div class="invisible-scrollbar">Long ul tag goes here or Thisisaveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylongword </div>
<div class="mostly-customized-scrollbar">Thisisaveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylongword<br>

.visible-scrollbar, .invisible-scrollbar, .mostly-customized-scrollbar {
  display: block;
  width: 10em;
  overflow: auto;
  height: 2em;
}
.invisible-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Demonstrate a "mostly customized" scrollbar
 * (won't be visible otherwise if width/height is specified) */
.mostly-customized-scrollbar::-webkit-scrollbar {
  width: 5px;
  height: 8px;
  background-color: #aaa; /* or add it to the track */
}
/* Add a thumb */
.mostly-customized-scrollbar::-webkit-scrollbar-thumb {
    background: #000; 
}