Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="page">
  <h1>Custom scrollbar mixin</h1>
  <p>See mixin for usage and technical details.</p>


                /* ==========================================================================
   ========================================================================== */
 * Allows to customize the browser's scrollbars.
 * Should work well in all modern browsers (no Internet Explorer).
 * Syntax:
 *    @include scrollbars(
 *        <thumb-color> [any valid color value (including CSS variable) | mandatory]
 *        <background-color> [any valid color value (including CSS variable) | mandatory]
 *        <scrollbar-size> ['thin', 'auto' or px value | optional]
 *    )
 * Usage:
 *    @include scrollbars(#888, var(--custom-color));
 *    @include scrollbars(hsl(80, 3%, 60%), hsl(80, 6%, 25%), 20px);
 *    @include scrollbars(#fff, rebeccapurple, thin);

@mixin scrollbars($thumb-color, $background-color, $size: auto) {
  // We assume that 12px more or less matches 'thin' on Firefox:
  $thin-size: 12px;
   * Target browsers: Firefox (W3C 'Working Draft' status).
  // Only set 'thin' if keyword matches or px value is rather small:
  @if ($size == auto) {
    scrollbar-width: auto;
  } @else if ($size == thin) or ($size <= $thin-size) {
    scrollbar-width: thin;

  scrollbar-color: $thumb-color $background-color;

   * Target browsers: Blink- and Webkit-based (Chrome, Safari, Opera, Edge, iOS, …)
  // Scrollbar size (checks for keyword first).
  // 'auto' is a valid value, the browser will use its original size then.
  &::-webkit-scrollbar {
    @if ($size == thin) {
      width: $thin-size;
      height: $thin-size;
    } @else {
      width: $size;
      height: $size;

  // Movable element in scrollbar:
  &::-webkit-scrollbar-thumb {
    background: $thumb-color;

    // If we set no border here, the movable element would have the same size
    // as the scrollbar's background (no padding).
    // 3px should be a good default for most scrollbar sizes.
    border: 3px solid $background-color;

    // If a pixel value is used, use it to calculate the border-radius:
    @if (type-of($size) == number) {
      border-radius: $size / 2;
    } @else {
      border-radius: $thin-size / 2;

  // Background color of scrollbar:
  &::-webkit-scrollbar-track {
    background: $background-color;
// End of mixin!

 * Some styling for the page. With applied scrollbar mixin.
html {
  background: rebeccapurple;
  color: #fafafa;
  font-family: "Helvetica Neue", sans-serif;
  height: 3000px;
  padding: 2rem;
  text-align: center;

  @include scrollbars(gold, lighten(rebeccapurple, 10), 20px);