How Do I Add a Preloader to Webflow?

Adding a preloader to your Webflow website can greatly enhance the user experience by providing a visual cue that the page is loading. In this tutorial, we will explore how to add a preloader to your Webflow site using HTML and CSS.

What is a Preloader?

A preloader, also known as a loading screen or spinner, is an animation or graphic that appears on a webpage while its content is being loaded. It serves as a visual indicator to let users know that the page is still loading and prevents them from getting frustrated with a blank screen.

Step 1: Create the Preloader HTML Structure

To create a preloader, we need to add some HTML markup to our Webflow project. Open your project in the Webflow Designer and navigate to the page where you want to add the preloader.

Inside the <body> tag, just before your main content, insert the following code:

<div class="preloader">
  <div class="spinner"></div>

The <div class=”preloader”> element serves as the wrapper for our preloader. The <div class=”spinner”> element will hold our loading animation or graphic. You can customize these classes later with CSS.

Step 2: Style the Preloader with CSS

We have added the necessary HTML structure for our preloader. Now it’s time to style it using CSS.

To do this, go to your Webflow Designer and navigate to Page Settings > Custom Code > <head>. Add the following code inside <style> tags:

.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #fff;
  z-index: 9999;
}spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
/* Add your loading animation or graphic here */

In the above CSS, we set the .preloader element to cover the entire viewport using position: fixed;, top:0;, left:0;, width:100%;, and height:100%;. We also gave it a white background color and a high z-index to ensure it stays on top of other elements.

The .spinner element is positioned in the center of the preloader using position:absolute;,



, and





<=translate(-50%, -50%);


You can customize the loading animation or graphic by adding your own styles or using a library like Spin.js or CSS animations.

Step 3 (Optional): Fade Out Preloader on Page Load

If you want your preloader to fade out once the page has finished loading, you can add the following JavaScript code:

In the above JavaScript code, we listen for the load event on the window object. Once the page has finished loading, we select the .preloader element and add a fade-out class to it. You can define the styles for this class in your CSS to create a fade-out effect.


Congratulations! You have successfully added a preloader to your Webflow website.

Preloaders not only improve the user experience but also give your website a more professional and polished look. Experiment with different styles and animations to make your preloader truly unique.

Remember to test your preloader on different devices and browsers to ensure it works seamlessly for all users. Happy coding!