I want to get a scrollbar with a thumb larger than the track. I can change the color, the opacity, everything, but I don\'t know how to change the size of the thumbs and the
You can use a background image to make it look like the scrollbar is smaller than the thumb.
.custom_scrollbar::-webkit-scrollbar {
width: 10px;
}
.custom_scrollbar::-webkit-scrollbar-track-piece {
/* This image is smaller than the width of the scrollbar-thumb */
background: url('scroll-bg.gif') center 0 repeat-y;
}
.custom_scrollbar::-webkit-scrollbar-thumb:vertical {
width: 10px;
border: 2px solid #ffffff;
background-color: #000000;
}
Just set border to scroll bar and make both background color and scrollbar border color same, like if your background color is white than set same for scrollbar's border-color.
p {
width: 400px;
background: #fff;
max-height: 300px;
overflow-y: scroll;
}
/* set border-color of scrollbar and background color of that section same */
::-webkit-scrollbar {
width: 6px;
border: 2px solid #fff;
background: #000;
border-radius: 5px;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #000;
border-radius: 5px;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #888;
}
html:
<p>"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC
"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</p>