.poem {
overflow: scroll;
scrollbar-color: red orange;
scrollbar-width: thin;
white-space: wrap;
height: 140px;
width: 140px;
}
<p class="poem">abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz
abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz
abcdefghjkilmopqrstuvwxyz abcdefghjkilmopqrstuvwxyz </p>
As per MDN-Scrollable Link I can’t see the thin scrollbar with a red thumb and an orange track so in my EDGE Version 113 browser I tried out the code snippet, but I can’t see the thin scrollbar with a red thumb and an orange track
in my EDGE Browser also. Please help my code error if any.
3
Answers
You are doing everything correct, it’s just that the
scrollbar-color
property is not well supported in all browsers. Basically only Firefox supports this. Open this question in Firefox and your demo works as expected.You can check out the browser support for this property on this page at the bottom: https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-color
the syntax is correct it just doesnt support your browser. scrollbar-color: red orange; scrollbar-width: thin; supports only firefox. try using
This is a way to style the scrollbar of the element. Try this:-
According to the MDN Web Docs:-
"::-webkit-scrollbar is only available in Blink- and WebKit-based browsers"
You can see ::-webkit-scrollbar has good browser support:-
https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-scrollbar#browser_compatibility
For scrollbar-color, the browser support is poor:-
https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-color#browser_compatibility
Hope it will be helpful.