About this snippet

Style browser scrollbars for a more consistent and branded look across your website using CSS. Works in WebKit-based browsers (Chrome, Safari, Edge) and Firefox.

Size
993 bytes
Uses
HTML, CSS
Loads
Nothing external
Views
356
<div class="custom-scroll-content">
  <p>This content is scrollable. Notice the custom scrollbar style applied to this specific div.</p>
  <p>Scroll down to see more content...</p>
  <div style="height:500px;"></div>
  <p>End of content.</p>
</div>
body {
  font-family: Arial, sans-serif;
}
.custom-scroll-content {
  height: 200px;
  width: 350px;
  overflow-y: scroll;
  border: 1px solid black;
  padding: 10px;
  background-color: #f0f0f0;
}

/* For Webkit browsers (Chrome, Safari, new Edge) */
.custom-scroll-content::-webkit-scrollbar {
  width: 12px;
}

.custom-scroll-content::-webkit-scrollbar-track {
  background: #e0e0e0; 
  border-radius: 10px;
}
 
.custom-scroll-content::-webkit-scrollbar-thumb {
  background: #888; 
  border-radius: 10px;
}

.custom-scroll-content::-webkit-scrollbar-thumb:hover {
  background: #555; 
}

/* For Firefox */
.custom-scroll-content {
  scrollbar-width: thin; /* "auto" or "thin" */
  scrollbar-color: #888 #e0e0e0; /* thumb and track color */
}
Esc
↑↓ moveEnter select

Start from a template

Open an .html file, or HTML, CSS, JS, Markdown, Less or TypeScript files. You can also drop them here. Styles and scripts go into their panes.

Share

Source

Keyboard shortcuts

Save