Tarek Salah uddin Mahmud Tarek Salah uddin Mahmud - 3 months ago 8
HTML Question

customize scrollbar design for any div but not for the body

I want to customize the scrollbar design. But it changer the scrollbar in the body also. I wants it only for selected divs. How can I do it?

Answer

You could add a class before defining the scrollbar style on your CSS.

/* Scrollbars */
.custom-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.custom-scroll::-webkit-scrollbar-track {
    background-color: #E0E0E0;
}
.custom-scroll::-webkit-scrollbar-thumb {
    background-color: #8B8B8B;
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
    background-color: #C40030;
}
.custom-scroll * {
    scrollbar-face-color: #8b8b8b;
    scrollbar-track-color: #e0e0e0;
    scrollbar-shadow-color: #C40030;
}
/* END Scrollbars */

https://jsfiddle.net/oLh66xut/1/