Skip to main content

May 2, 2023

How to Use Classes in Webflow

3 min read

screenshot of webflow classes

Let's delve deep into the world of classes, a cornerstone concept in web development, and specifically, in using Webflow. Classes are instrumental in shaping our HTML elements and ensuring uniformity across web designs.

We'll explore:

  • What classes really are
  • The reasons behind their crucial role in web design
  • The most effective ways to use them.
  • We'll also address how the automatic naming of elements by Webflow could create complications in our design process, and share strategies to avoid these obstacles.

If you want to boost your efficiency in web development, maintain consistency across your projects, and understand how to better organize your work, keep reading.

Alright, let's dive in and uncover the power of classes.

What is a Class?

First, let's define what a class is.

A class is simply a name given to an HTML element that allows us to select that HTML element and apply some CSS styles.

In Webflow, the left sidebar contains our Navigator, which shows all our HTML elements and the classes applied to those elements. The right side bar is our CSS panel, and up top is where we apply and select names for the elements.

Using classes allows us to build much faster, save time, and maintain consistency in our builds. For example, if you apply the same class to multiple elements, they will all have the same styles applied. This is useful for maintaining consistent spacing, padding, and other styles across the entire website.

The Power of Classes

style selector webflow

I use Finsweet's Client First system, which is reflected in the naming conventions used throughout the website. This system uses descriptive names for classes, such as "section_home_header" and "padding_page_global." By applying these classes consistently throughout the website, we can easily maintain consistency in spacing and padding.

Classes also allow for easy updates. If a client wants more space between sections, for example, we can adjust the padding of a single class and see the changes reflected across all elements using that class.

Organizing and Naming Classes

html navigator webflow

It's important to name your classes in an organized and descriptive way. This not only helps you understand the structure of the website but also makes it easier for other developers to work on the project.

For example, by naming a class "section_home_header," we know that this is a section on the home page and that it's the header. Similarly, using classes like "text_size_large" and "text_color_white" makes it clear what the class will do when applied to an element.

Beware of Webflow's Automatic Naming

Webflow tries to be helpful by automatically naming elements when you apply styles to them. However, this can result in names like "div block 1000" and "image 2000," which are not helpful for understanding the structure and organization of the website.

To avoid this, always name elements before applying styles to them. Don't let Webflow name your classes for you; instead, take the time to create descriptive and organized names for each class.

Conclusion

Understanding and using classes effectively is crucial for becoming a better developer. By leveraging the power of classes, you can speed up your development process, maintain consistency, and improve the overall organization of your projects.

If you want to learn more, you can watch an extended video on this topic.

‍

Cover of the guide 10 Marketing Mistakes Contractors Make, by Casey Lewis of CL Creative

10 Marketing Mistakes Contractors Make

A free guide to the 10 ideas that sound reasonable but cost you jobs, and the 10 rules that keep your phone ringing and your calendar booked up.

Questions You Might Be Asking

A class holds the base styles that apply wherever you use it. A combo class is a second (or third) class layered on the first that only affects elements carrying both. For example, button plus button-large adds padding on top of button's shared styles. Use combo classes for modifications, never for foundational styles, or you'll end up with styles trapped inside unreachable combinations.

Select the element, click the class name in the Selector field, and rename it. Webflow updates every instance site-wide because classes are shared references. Before renaming, check how many instances exist — if the class is reused in ways you don't expect, consider duplicating it first. Always preview key pages after bulk renames to catch anything that now looks off.

Use classes for styling, IDs for linking. IDs should only be used when you need a unique anchor — like a section you want to scroll to via /#contact — or when an interaction or custom script needs to target one specific element. Styling with IDs makes your CSS harder to reuse and locks styles to a single element. Classes are almost always the right call.

Keep it to three or four max. A solid pattern is one custom class for the element's role, one or two utility classes for shared styles like padding or text size, and one modifier class if needed. Stacking more than that usually means you're fighting your naming system. If you're adding a fifth class, step back — your base class probably needs refactoring.

Ready to win back the jobs going to your competitors?

Tell us about your business. We'll show you what the plan covers and what it would look like for you.

A finished backyard pergola and stone fire-pit patio glowing at dusk behind a home

Other posts in this category

A three-way comparison graphic: three website mockups side by side labeled DIY Builder, Template, and Custom, each with a small price tag and a "best when" note beneath it, and an arrow underneath showing the progression as a business grows.

Is a Custom Website Worth It, or Should I Use a Template or DIY Builder?

Custom, template, or DIY builder? Here's how the three options compare, plus a simple decision framework.

confetti over Vimeo Video playing

How to Add a Confetti Animation When a Vimeo Video Starts Playing

Learn how to trigger a canvas confetti animation when a Vimeo video starts playing using the Vimeo Player API play event

vimeo logo against a blue background

How to Use the Vimeo Player API to Control Video on Your Website

Learn how to use the Vimeo Player API to control embedded video with JavaScript. This guide covers setup, play/pause, promises, events, and common pitfalls.