EN
CSS - how to change vertical scrollbar width?
1 answers
8 points
How can I change vertical scrollbar width?
More precisely, I want to change this part:
1 answer
2 points
To change vertical scrollbar width you need to use custom styles for scrollbar, its track and thumb. In other case you won't be able to change the width.
Quick solution:
xxxxxxxxxx
1
.container::scrollbar {
2
width: 12px; /* <-------------------------- it changes vertical scrollbar width */
3
}
4
5
.container::scrollbar-track { /* <----- required */
6
background: #efefef;
7
}
8
9
.container::scrollbar-thumb { /* <----- required */
10
background: #ffea75;
11
}
Practical example:
xxxxxxxxxx
1
2
<html>
3
<head>
4
<style>
5
6
.container {
7
height: 100px;
8
width: 250px;
9
overflow-y: scroll;
10
}
11
12
.container::scrollbar {
13
width: 12px; /* <-------------------------- it changes vertical scrollbar width */
14
}
15
16
.container::scrollbar-track { /* <----- required */
17
background: #efefef;
18
}
19
20
.container::scrollbar-thumb { /* <----- required */
21
background: #ffea75;
22
}
23
24
</style>
25
</head>
26
<body>
27
<div class="container">
28
Some text here...<br />Some text here...<br />Some text here...<br />
29
Some text here...<br />Some text here...<br />Some text here...<br />
30
Some text here...<br />Some text here...<br />Some text here...<br />
31
Some text here...<br />Some text here...<br />Some text here...<br />
32
</div>
33
</body>
34
</html>
See also
0 commentsShow commentsAdd comment