Webflow sync, pageviews & more.
NEW

How can I implement a custom horizontal scrollbar like the one shown in the attached image using Webflow?

TL;DR
  • Create a flex, no-wrap scroll-container div with overflow-x set to scroll and overflow-y hidden.
  • Use an HTML Embed or Page Settings to add custom CSS targeting the scrollbar: style width, track, and thumb for both Webkit and Firefox browsers.
  • Customize scrollbar appearance with matching colors, thickness, and optional smooth scrolling, fading edges, or drag-to-scroll enhancements.

You want to implement a custom horizontal scrollbar similar to the one shown in your attached image. Here’s a straightforward way to set this up using Webflow's Designer and simple native features.

1. Set Up the Scrollable Container

  • Create a Div Block and give it a class name (e.g., scroll-container).
  • Inside the div, add the elements you want to scroll horizontally (like images, cards, or text blocks).
  • Select the scroll-container and under Overflow settings, choose Overflow: Auto or Overflow-X: Scroll and Overflow-Y: Hidden.
  • Set Display: Flex, Direction: Row, and No Wrap to make items align horizontally.

2. Style the Native Scrollbar with CSS

  • Webflow’s Designer does not directly customize scrollbars natively, so you’ll need a bit of custom CSS.

  • Embed an HTML Embed Widget inside the page or in the Page Settings → Inside the <head> section.

  • Insert custom CSS targeting the class you assigned (scroll-container). For example, use:

    • Set scrollbar-width: thin; and scrollbar-color: #color1 #color2; for Firefox.
    • Use ::-webkit-scrollbar, ::-webkit-scrollbar-thumb, and ::-webkit-scrollbar-track for Webkit browsers (Chrome, Edge, Safari).

Example inline usage:

  • "::-webkit-scrollbar" for controlling scrollbar width and background;
  • "::-webkit-scrollbar-thumb" for controlling thumb color and shape;
  • "::-webkit-scrollbar-track" for the track background color.

3. Customize Scrollbar Appearance

  • Adjust the thickness of the scrollbar to match your design.
  • Set the thumb (the draggable part) with colors, border-radius, and sizing to reflect the design in your image.
  • Make sure your colors and shapes match Webflow's color swatches for a cohesive design system.

4. Additional Enhancements (Optional)

  • Smooth Scroll Behavior: Set overflow scrolling to "smooth" for a softer user experience.
  • Add Fading Edges: You can create small gradient overlays at the edges to hint that more content is scrollable.
  • Drag-to-Scroll: Using a small JavaScript snippet, you can enable click-and-drag scrolling functionality if desired.

Summary

To create a custom horizontal scrollbar in Webflow: set up a flex, no-wrap scrollable container, apply overflow-x: scroll, and embed simple CSS to style the native scrollbar. Use Webkit and Firefox-specific scrollbar selectors to match the visual style exactly like your attached example.

Rate this answer

Other Webflow Questions