I changed scrollbar thumb color to blue:
However, the thumb showed all the time.
Anyway can make it show only scrolling just like browser do?
Below is my code, you can copy and test:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
div#scrollable {
border: 5px red solid;
width: 150px;
height: 200px;
overflow-y: auto;
}
::-webkit-scrollbar {
width: 6px;
}
::-webkit-scrollbar-thumb {
background: blue;
border-radius: 3px;
}
</style>
</head>
<body>
<div id="scrollable">
<p style="height: 1000px">my text</p>
</div>
</body>
</html>
2
Answers
Use the below code to show the scrollbar whenever you can scroll up or down as per your requirement.