mdBook: scroll bar customization

I'm having trouble to customize the web scroll bar using the mdBook utility from the Rust community. There is no such issue in my previous mdBook document.

Sources and result


  • Parts related to scroll
html {
    scrollbar-color: var(--scrollbar) var(--bg);

.sidebar::-webkit-scrollbar {
    background: var(--sidebar-bg);
.sidebar::-webkit-scrollbar-thumb {
    background: var(--scrollbar);


  • Parts related to scroll
.ayu, .coal, .light, .navy, .rust {
    --scrollbar: var(--sidebar-fg);


The scroll bar is expected to have the same track background color as the sidebar background color. I've failed to use the --webkit-x selectors to customize it.

Here is the repository's directory containing the document.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.