Webflow
September 2024

Why You Should Use CSS Animations in Webflow (Soon)

Have you noticed your Webflow sites taking longer to load, especially as they grow more complex? It’s a common issue—every time you add a new interaction, more JavaScript is piled onto your site, creating unnecessary bloat. And here’s the catch: Webflow loads all that JS on every single page, even when it’s not needed. The result? Slower load times and clunky animations.

Now, while GSAP (GreenSock Animation Platform) is a seriously powerful and lightweight tool for creating intricate animations with JavaScript, we won’t be covering that today. Why? Because this year, CSS got a huge upgrade. Some of these features are still experimental, but they’re poised to be absolute game-changers for animating elements on your page—especially in terms of performance and ease of use.

With the right approach, CSS animations can keep your code leaner, improve performance, and deliver smoother transitions—all without sacrificing creativity. And with new CSS features like scroll-driven animations, view transitions, and the ability to animate elements like HTML modals and dialogs, there’s never been a better time to be a CSS nerd.

In this post, you’ll learn exactly how and why CSS animations will be a smart alternative to Webflow’s native interactions. By the end, you’ll be able to make an informed decision about when to use CSS to keep your website fast, efficient, and visually engaging.

Why Webflow’s Native Interactions Cause Bloat Over Time

Webflow's Logo and their interactions symbol on a blue and purple background.

Webflow’s interactions are incredibly powerful for creating visually engaging websites without needing to touch code.

However, the convenience can sometimes come at a cost—performance. Each time you add a new interaction, Webflow generates additional JavaScript to power that animation.

The problem? Webflow doesn’t just load the JS for the interactions you’re using on a specific page—it loads all the JS for every interaction across your entire site.

For smaller websites with few interactions, this might not be a big deal. But as your site grows, every new animation adds weight to your JS file, and all that extra code starts to slow things down.

Because Webflow bundles all the interactions into a single JavaScript file, the browser has to load that entire file, even on pages that aren’t using most of the animations. The result is a heavier website, slower load times, and a less smooth experience for users.

In contrast, CSS animations are handled by the browser’s rendering engine, meaning they run super fast, and don’t require a fully loaded DOM to take effect (which JavaScript does need). On top of that, you can choose which pages load the CSS animations with the use of Webflow's HTML embeds (we'll cover this in the next section). This not only reduces the amount of code your site has to load but also ensures that animations remain smooth and lightweight, even on large or complex websites.

The Advantages of CSS Animations in Webflow:

The CSS Logo and text that reads "CSS Animations"

Still not convinced it's worth your time to try CSS animations for your next project? While they may not be necessary for every build, it's still important to know how they can make a difference.

CSS animations can offer a more efficient and lightweight alternative to Webflow's native interactions, especially when it comes to managing animations on larger websites. By leveraging custom code through CSS, you can significantly reduce the amount of JavaScript loaded on your pages while keeping animations smooth and performance-optimized.

Let's break down a few of the upsides to using CSS in more detail.

1. Faster Load Times

One of the key benefits of using CSS animations in Webflow is the ability to limit unnecessary JavaScript. Instead of relying on Webflow’s interactions, which bundle all JS animations together regardless of whether they’re used on a particular page, CSS animations allow for greater control.

By using an HTML embed in Webflow, you can write custom animation keyframes directly within style tags and apply those animations only where needed. This means you're not loading excess code on pages where it's not necessary, keeping the overall file size down and your site faster.

2. Smoother Animations

CSS animations benefit from hardware acceleration, meaning they can take full advantage of the GPU (graphics processing unit) for smoother transitions and less strain on the device. This is especially beneficial for mobile users, where JS-based animations can slow down performance. By embedding CSS animations into your project and assigning them to elements via class names, you ensure that the animations run fluidly, even on more resource-constrained devices.

3. More Control Through Webflow Components

Webflow's logo, and component functionality shown in green "create reusable components for your CSS animations"

With CSS animations, you can also take advantage of Webflow’s component system for greater flexibility. For example, after creating all of your animation keyframes in an HTML embed, you can turn that element into a Webflow component. This allows you to reuse those animations across different pages by adding the component where needed. More importantly, you can skip adding it to pages that don't require the animation, preventing unnecessary code from being loaded on those pages.

4. Streamlined Workflow with Combo Classes

Webflow's logo and combo class structure shown close up.

One of the more powerful tricks when using CSS animations in Webflow is the ability to apply these styles through combo classes. After you’ve defined your animation in an HTML embed and given it a class name, you can apply that class to any element as a combo class.

This allows for easy application of animations across the site. Better yet, Webflow’s style panel gives you the flexibility to modify custom properties like duration, easing, or looping for individual elements, without having to rewrite the entire animation. This efficiency keeps your code clean and minimizes unnecessary duplication, something that’s harder to achieve with JS-based animations.

5. Scalability Without Performance Loss

As your Webflow site grows, relying heavily on JavaScript interactions can lead to bloated code and slower load times. CSS animations, however, scale much more efficiently. By carefully targeting animations to the specific pages and elements that need them, you avoid the pitfalls of Webflow’s all-inclusive JS bundling.

New CSS Animation Features You Should Know About:

CSS animations are evolving rapidly, offering more control and creative possibilities than ever before. Here are some of the latest features that can help you build dynamic, performance-optimized animations in Webflow without the need for JavaScript.

1. Scroll-Driven Animations

A computer mouse icon with text reading "Scroll Driven Animations" "A bunch of demos and tools to show off scroll-driven animations"
Image Credit: https://scroll-driven-animations.style/

CSS scroll-driven animations are a game-changer for creating interactive experiences directly tied to user scrolling. With the new scroll() and view() functions, you can define custom timelines that allow animations to be triggered and controlled based on scroll position or element visibility.

These animations are perfect for building engaging scroll-based effects like parallax or revealing content, all without writing a single line of JavaScript. This feature significantly reduces the complexity and weight of your site, making it an ideal solution for Webflow projects.

Check out this sweet demo of CSS scroll-driven animations to see them in action.

2. View Transitions

@view-transition

View transitions are one of the most exciting new CSS features, allowing smooth animations between different pages or sections of your site.

This can be particularly useful for creating seamless navigation experiences, like transitioning between a homepage and a detailed content page. Previously, this required complex JavaScript setups, but with the @view-transition rule, you can now manage these animations purely with CSS. View transitions are already being adopted by companies like Airbnb to deliver fluid, user-friendly web experiences.

Check out Google's demos of view transitions here.

3. Scoped Animations

@scope

The new @scope rule allows you to limit animations and styles to specific areas of your page, ensuring that complex animations don’t interfere with other parts of your design.

This is particularly useful in large, multi-section layouts or when dealing with nested components. Scoped transitions can isolate the animated elements, giving you precise control over which parts of your design are animated, all while keeping the rest of the page interactive.

4. Animating Dialog and Modal Elements

With the growing support for newer HTML elements like <dialog>, CSS now provides more robust control over animating these components. Animating modal windows, for instance, has traditionally been done with JavaScript for full control over transitions.

See example:

Now, you can create elegant, responsive opening and closing animations entirely with CSS. This is especially useful in Webflow when you want to maintain a clean codebase while still delivering high-quality user experiences. It's important to note that browser support for this functionality is not 100% just yet. Check out this awesome tutorial by Kevin Powell for more information.

These new features are part of the broader trend of moving more complex interactions from JavaScript into native CSS, which enhances performance and reduces page load times. Incorporating these tools into your Webflow projects can help you deliver smooth, performant, and engaging animations without the JavaScript overhead.

Browser Support and the Future of CSS Animations:

CSS logo. "The Future of CSS"

One of the key considerations when using CSS animations in Webflow is browser support. As new CSS features roll out, developers often worry about whether their animations will work consistently across different browsers.

Thankfully, the landscape for CSS animations has greatly improved in recent years, with near-universal support for most modern features.

Supported Now

The majority of advanced CSS animations, including keyframe animations, transitions, and transforms, are now supported across all major browsers like Chrome, Firefox, Safari, and Edge.

With scroll-driven animations and view transitions becoming more widely adopted, even these newer features are gaining solid support across platforms. For example, Chrome and Firefox both support these features in their latest versions, while Safari is quickly catching up. You can read more about that here.

Supported Soon

Looking ahead, CSS is set to offer even more powerful tools for creating animations. Features like gesture-driven view transitions and scoped animations will soon allow developers to create native-like interactions on the web without resorting to complex JavaScript code. Additionally, improvements in cross-document view transitions will make it easier to animate content between pages, creating a more fluid user experience.

As browser support continues to improve, developers will have even more creative freedom to build sophisticated animations with minimal performance trade-offs.

When to Use CSS Animations and When to Stick with Webflow Interactions:

CSS or Webflow Interactions, Which should you use?

Knowing when to use CSS animations versus Webflow’s native interactions can make all the difference in both performance and ease of maintenance. While CSS animations offer lightweight, efficient solutions for many cases, there are times when Webflow’s native interactions are still useful.

Use CSS Animations When The Animation Is Simple, Or When Performance Is a Concern

CSS animations are ideal for simple, repetitive tasks or when you want to prioritize performance.

They work best for straightforward animations like hover effects, page load animations, endless loops (such as an element rotating or moving back and forth), and logo/testimonial carousels that float horizontally across the screen.

These types of animations are not resource-intensive and benefit from the speed and smoothness CSS offers (they’re also fairly simple to write). Using CSS for these simpler cases ensures that your animations stay lightweight, avoiding the JavaScript overhead that Webflow’s interactions can introduce. This is especially important on larger websites or when load speed is a priority.

Use Webflow Interactions for Complex, Multi-Step Animations

For now, Webflow’s native interactions are still the go-to tool for complex animations that involve multiple elements, timed sequences, or intricate triggers.

While CSS animations have made significant strides, there are scenarios—like animating elements based on user interactions (e.g., clicks, scrolling, or mouse movements)—where Webflow’s interactions provide more out-of-the-box functionality.

If your project requires animations that are triggered by specific user inputs or need precise control across multiple elements, Webflow’s interactions may be a better fit.

Combine Both for Maximum Flexibility

In many cases, the best approach is a hybrid one, where you use CSS animations for performance-critical elements and Webflow interactions for complex user-triggered animations.

For instance, you could use CSS for animating logo bars, rotating elements, hero section page load sequences, (and soon scroll-driven animations), while relying on Webflow’s interactions for more elaborate animations that require more specific user input.

This combination allows you to optimize your site’s load times while still enjoying the creative freedom of Webflow’s powerful tools.

Wrap Up

Choosing between CSS animations and Webflow’s native interactions ultimately comes down to the complexity of your animations and how much control you need. CSS animations give you a lean, efficient way to handle simple effects while keeping your codebase clean. With recent updates, CSS is more powerful than ever, making it a strong choice for many use cases.

On the other hand, Webflow’s interactions can still be incredibly useful for more complex animations that require multiple steps or user triggers. By striking the right balance between the two, you can maintain both creativity and performance in your projects.

Need a hand with your Webflow project? Have a question or want to chat more about Webflow and web design? Hit me up! I’m here to help, and always open to new ideas.

Some illustrations in this post were made possible by:
A portrait of Dalton Craighead, a Web Designer and Web Developer.
Dalton Craighead
Web Design & Development
Get in touch