CSS Scrollbar Generator
Design a scrollbar for a whole page or one scrolling box, get both the standard and the WebKit CSS, and check that the thumb is easy to see.
브라우저에서 실행됩니다. 파일은 기기 밖으로 나가지 않습니다. 확인하는 방법 보기
…
사용 방법
- 1Choose where it applies
Pick One scrolling box and type a class name, or The whole page.
- 2Start from a style
Tap a preset such as Slim grey, Brand blue or Hidden but scrollable.
- 3Set colours and size
Choose thumb, hover, dragging and track colours, the WebKit width, the standard width and the rounding.
- 4Set the extras
Turn on dark mode colours, arrow buttons, a rounded track or a stable gutter.
- 5Check the preview
Scroll and hover in the preview, try the dark colours and read the contrast checks.
- 6Copy the CSS
Copy or download the CSS and add the class to your scrolling element.
이 도구 소개
Default scrollbars are wide and grey, and they rarely fit a dark theme, a chat panel or a code box. Styling them used to mean a pile of ::-webkit-scrollbar rules that Firefox ignored, and since Chrome and Edge 121 started supporting the standard properties, many old snippets no longer behave as expected. This generator writes both layers in the right way. The standard scrollbar-width and scrollbar-color properties go on the scrolling element, which Firefox, Chrome and Edge use. The ::-webkit-scrollbar rules for the bar, track, thumb, corner and buttons follow, which Safari and older Chromium versions use; current Chrome ignores them once the standard properties are set, so the two never fight. You choose whether the styles apply to the whole page or to one class, such as a sidebar or a chat window, and set the thumb colour, a hover colour and a colour while dragging, the track colour, the width for WebKit browsers and the thin or normal width for the standard property, the rounding of the thumb and a gap around it that makes it look like it floats inside the track. Further options add arrow buttons, a rounded track, scrollbar-gutter: stable so the layout does not jump when a scrollbar appears, a dark-mode colour pair, and a standard-only output for projects that do not need the older rules.
Hidden but scrollable
For carousels, chip rows and image strips that scroll sideways, a hidden scrollbar can look cleaner. The hide option writes scrollbar-width: none plus display: none for the WebKit bar, and the content still scrolls with a wheel, a trackpad, touch and the keyboard. The checks then remind you to give people another hint that there is more, such as a fade at the edge, arrows or a peek of the next item.
Preview and dark mode
The preview is a real scrolling box, or a whole page, with a wide row so you can see the horizontal bar and the corner too. Tick Preview the dark mode colours to see the dark pair without changing your system setting; in the CSS the dark colours sit inside a prefers-color-scheme: dark media query.
Visibility checks
WCAG 1.4.11 asks for a contrast of 3 to 1 for the parts of a control people need to find. The checks measure the thumb against the track in light and dark mode and work out how wide the visible thumb is in Safari after the gap is taken away, since a thumb narrower than about 6 pixels is hard to grab.
Limits
Hover and active colours only apply in browsers that use the WebKit rules; the standard properties allow just two colours. Phones and tablets draw their own thin overlay bars and ignore most of this styling, and macOS hides scrollbars until you scroll unless the system setting says always. The tool does not build JavaScript scrollbars or scroll-snap carousels.
풀이 예시
The default design styles a .scroll-area box with a #64748b thumb on a #f1f5f9 track, a contrast of 4.34 to 1, which passes the 3 to 1 guideline. The bar is 12 pixels wide in Safari with a 3 pixel gap on each side, leaving a 6 pixel thumb. In dark mode the thumb stays #64748b on a #0f172a track, 3.75 to 1. The macOS-like preset, a #c1c1c1 thumb on white, only reaches 1.80 to 1 and is flagged.
한눈에 보기
- 카테고리: 개발 및 데이터
- 브라우저에서 실행되며 가입도 업로드도 필요 없습니다.
- 입력한 정보는 기기에 머뭅니다.
- 영어로 제공됩니다.
- 콘텐츠 최종 검토일:
- 공식 출처: W3C CSS Scrollbars Styling Module Level 1 (scrollbar-width, scrollbar-color)
자주 묻는 질문
Why does my ::-webkit-scrollbar style not work in Chrome any more?
Since version 121, Chrome and Edge support scrollbar-width and scrollbar-color. When either is set on an element, Chrome uses them and ignores the ::-webkit-scrollbar rules. Set the standard properties for Chrome and Firefox and keep the WebKit rules for Safari, as this generator does.
Can I make the scrollbar thinner in Firefox?
Firefox offers scrollbar-width: thin or auto, not an exact pixel width. Thin is about 8 pixels. Exact widths only work in Safari and older Chromium through the WebKit rules.
Is hiding the scrollbar bad for accessibility?
It removes a visual clue that the area scrolls. Content can still be scrolled by touch, wheel, trackpad and keyboard, but people may not realise there is more. Add another clue, such as a fade or arrows, and keep the scrolling area focusable if it holds no focusable items.
What does scrollbar-gutter: stable do?
It reserves the space for a scrollbar even when the content is short, so the layout does not shift sideways when the content grows and the scrollbar appears.
Should I style the whole page or one box?
Styling one box, such as a sidebar, chat list or code block, is usually safer. Many people rely on the familiar page scrollbar, and system scrollbars respect their own accessibility settings.
Do the styles work on phones?
Mostly not. iOS and Android draw thin overlay scrollbars that appear while scrolling and ignore custom colours and widths. The styles matter on desktop browsers.
