ul
的{{1}}从height
改为300px
。 ul设置为900px
,每当overflow-y: scroll
的高度增加时,ul
和scrollbar track
都会随之调整大小。
无论scrollbar thumb
和scrollbar thumb
如何,您如何将 ul
设置为固定尺寸(高度)调整大小?
我尝试添加到scrollbar track
,但没有成功。
请查看关于问题的图片
-webkit-scrollbar-thumb
答案 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;
}