Create a custom scrollbar

Why not take a look at how to create a custom scrollbar? That's the whole point of this article!
•
Updated on August 14, 2026
•
1 min read
Believemy logo

Creating a custom scrollbar is often very useful for those who appreciate frontend development and want to give an original touch to their website. However, what you will see in this article is currently only compatible with Safari and Google Chrome. Your other visitors will continue to see the classic scroll bar.

You can find the entire tutorial on our Instagram account.

 

Step 1

As we just saw in the introduction to this article, this scrollbar is only available on Safari and Google Chrome: therefore, we specify -webkit- in our CSS file:

CSS
body::-webkit-scrollbar {
    width: 10px;
}

 

Step 2

It's time to define the background color of the scrollbar (the color of the bar itself).

CSS
body::-webkit-scrollbar-track {
    background-color: #e5e5e5;
}

 

Step 3

We have defined the width and color of the bar... Now we will specify the color of the thumb (the small bar that allows scrolling through a page).

CSS
body::-webkit-scrollbar-thumb {
    border-radius: 15px;
    background-color: #5c2a9d;
}

 

Step 4

Final step of this project: define the color of the thumb when hovered. For this, we will use the very famous hover event selector:

CSS
body::-webkit-scrollbar-thumb:hover {
    background-color: #b5076b;
}

 

Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

Creating an "Old School" button with CSS

Let's find out how to create an original button that's right up to date!

December 9, 2024

Create a playback progress bar

Whether you have a blog or content to read, offering a reading progress bar is really necessary for the comfort of your users. This article will show you how!

December 6, 2024

Creating an animated list with CSS

Let's find out how to create an animated hover list!

December 9, 2024

Create a menu that spans the entire page using CSS

From time to time we have to ask our visitors which page they want to go to, by displaying the main sections of our website. This menu is often not very pleasant to use, so let's find out together in this article how to make it much more modern, with beautiful animations that will make your passers-by want to visit your site!

December 9, 2024

Creating a button with a "fill" effect using CSS

In this article, we'll be taking a look at the secret to achieving this "filling" effect on a button!

December 9, 2024

Create a navigation bar with an animated indicator

Have you always wanted a dynamic navigation bar with an indicator that glides smoothly underneath the new page you're on? This navigation bar is exactly what you need!

December 6, 2024

Creating a glassmorphic connection form in HTML and CSS

In this article, we're going to create a form with a glassmorphic design. Modern effect guaranteed!

December 9, 2024

Animating a checkbox with CSS

Animating the checkboxes in your forms can greatly improve the experience your users have and will undeniably increase their desire to fill them in. A form that's more fun to fill in is a form that your users will fill in more often. In this article, we'll look at how to animate a checkbox using CSS!

December 9, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.