When the scroll bar in div appears, how to solve the jitter of the contents in the container?

scenario:

A div sets the content beyond the display scroll bar, but the scroll bar does not appear until the mouse is over the content block. It does not appear by default, just like the scroll bar of the QQ chat interface

.

clipboard.png

paste my code first:

.filterColor {
height: calc(~"100% - 70px");
overflow:hidden;

}

.filterColor::-webkit-scrollbar {
width: 8px;

}

.filterColor::-webkit-scrollbar-track {
background-color:transparent;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius:4px;

}

.filterColor::-webkit-scrollbar-thumb {
background-color: rgb(204, 204, 204);
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius:4px;

}
/ / move the mouse into the display, move it out and disappear

.filterColor: hover {
overflow-y: scroll;

}

but if you write this, the contents of the filterColor container will want to move the width of a scroll bar to the left when the mouse is moved in.
does any boss have a solution? thank you

Oct.22,2021
Menu