How can I style the scrollbar on Safari and Firefox in Webflow to act as an overlay instead of taking up space in the body?

Published on
September 22, 2023

To style the scrollbar on Safari and Firefox in Webflow to act as an overlay instead of taking up space in the body, you can utilize custom CSS along with Webflow's built-in features. Here's a step-by-step guide on how to achieve this:

  1. Enable the Custom Code
  • Open your Webflow project and go to the Project Settings.

  • In the Custom Code tab, you will find two sections: Head Code and Footer Code. We will add our custom CSS in the Head Code section.

  • Copy and paste the following CSS code snippet:

    ```css
    /_ Hide the default scrollbar _/
    body::-webkit-scrollbar {
    width: 0.5em;
    }

    body::-webkit-scrollbar-thumb {
    background-color: #888;
    }

    /_ Style the custom scrollbar _/
    body {
    scrollbar-width: thin;
    scrollbar-color: #888;
    }
    ```

  1. Create a Custom Class
  • Go to your Webflow project and open the Designer.
  • Select any element on the page where you want to apply the custom scrollbar style.
  • In the right panel, click on the Plus icon next to the Selector field.
  • Enter a new class name, e.g., "custom-scrollbar" and press Enter. This class will be used to target the element where you want to apply the custom scrollbar.
  1. Apply the Custom Class
  • With the element selected, scroll down to the Custom Code section in the right panel.
  • In the Before tag field, click on the Plus icon.
  • Select the "custom-scrollbar" class you created earlier.
  1. Preview and Publish
  • Go to the top-right corner of the Designer and click on Preview Mode to see the custom scrollbar in action.
  • If you're satisfied with the result, publish your project for the changes to take effect on your live website.

By following these steps, you should now have a custom scrollbar overlay on Safari and Firefox in your Webflow project.

Additional Tips:

  • You can customize the appearance of the scrollbar by modifying the CSS properties in the code snippet. For example, you can change the width, color, and background color to match your website's design.
  • It's a good practice to test your custom scrollbar on different browsers to ensure consistent styling across platforms.

Troubleshooting:

  • If you don't see any changes or experience issues with the custom scrollbar, make sure that you have correctly copied and pasted the CSS code snippet into the Head Code section in your Project Settings.

  1. How do I style the scrollbar in Webflow?
  2. Can I customize the appearance of the scrollbar in Safari and Firefox using Webflow?
  3. Are there any limitations or compatibility issues when styling the scrollbar in Webflow?