Naming convention

Follow 'Client-first' naming convention to keep your website organized as your customize and scale.

Clients - Your website will be set up with the below rules. You don't have to understand the specifics of 'Naming convention' to manage and grow your new Webflow website.
Webflow devs - Learn it. You'll thank yourself later.
Be clear:

Client-first is a set of guidelines and tools to help you build Webflow websites in a clear understandable way. These are not strict rules. Every build is different. Client-first is made to be flexible and customizable.

Meaningful class names

Class names should say what they do. When creating a name for a class think to yourself,

"What is this class doing?

What is its purpose?"

The answer to these questions should be represented in the name of class.

When you are naming classes, describe what that class is doing. Give the client as much context into what the purpose of the class.

IMPORTANT: A Webflow developer, client, or marketer should be able to understand what is happening based on a class name.

Using prefix keywords for organization and class search

'Client-first' naming convention uses prefixes and keywords for organization.

There are two core reasons for this strategy:

1. Search for available classes when typing a class in Webflow Designer.

2. Identify and understand what a class is responsible for in the build.

Search for available classes when typing a class in Webflow Designer

When we start typing class names in the Style panel of Webflow Designer, a list of classes appear as a suggestion for our typed class.

If we want to find a class that sets a max-width, we will type our .max-  prefix to search for our global glasses that control max-width. We are using the word 'max' as our prefix keyword for max-width. Typing 'max' in the Style panel will return all of of out classes that refer to max-width, for example, .max-128  .max-256  .max-512  .max-768

Now we can select the max-width option that we want without remember the specifics of the class name. Using the prefix gives us a clear, organized search result for this important style.

The concept of class is search is seen throughout Client-first. When we create components in our Webflow project, our component name serves as our prefix keyword.

For example, we may create a "testimonial slider" component in our project. We will give the testimonial slider, as well as all of the elements inside, a prefix of .testimonial-slider_ . Now when we type 'testimonial-slider' in the Styles panel, we can view all custom classes related to our testimonial slider.

Identify and understand what a class is responsible for in the build

A strong keyword give you context into what this class/element is doing. Being as descriptive as possible in your naming will help you stay organized.

Let's look at the examples above.

.max-  is telling us this class is for max-width. This will be the only style applied to this class. The prefix identifies the style applied to it and the reason we created this class. When we see the class .max-128 we know this is a style of max-width of 240px. This class name tells us exactly what we need to know when we use it in our build.

.testimonial-slider_ is telling us that this a custom class created and used for our testimonial slider. The prefix identifies the component or element that it is being influenced by this class. When we see the class .testimonial-slider_headshot-wrapper , we know that this class is created specifically for a headshot wrapper inside of our testimonial slider component. We get a lot of context around what this class is used for on our website.

Our prefix keywords can help us identify:

- The css style the class is created for (.max-128, .background-green)

- The page element the class is created for
(.testimonial-slider_headshot-wrapper, .card1_ layer-top, .form-submit, .cta-alternative)


When to use one or the other?

It is up to you, the developer, to name your classes so they give the most amount of context while staying organized and meaningful in your build.

As you continue reviewing and understanding this documentation, you will better understand how to give meaningful names to your classes.

Classes pre-written in Client-first cloneable

Client-first build comes with classes and styles that help you get started with any Webflow project. These classes are not specific to any website, design, style, or layout. We give you styles that:

- Core build classes that help you establish a strong page structure

Here are some prefixes of classes that are included with the client-first build

.page- .container- .max- .space- .section-space .hide- .show- .text-

Our core outer page structures can be built with these pre-written classes.
.page-wrapper
.section
.container
.page-padding
...(e.g. components, elements, etc.)
Use .space- classes to establish vertical space inside and outside of your page elements. Using .space- classes will help keep your vertical spacing global throughout your build.
.space-bottom-xsmall
.space-bottom-small
.space-bottom-medium
It's very important to know that all pre-written styles inside Client-first are optional. If you build requires you to organize spacing in a different way, or use a unique structure for outer page structure, you may do it. Client-first helps you stay organized and deliver clean Webflow builds. If your build needs to do something different to stay organized, do it.

Creating unique classes for your build

Always use clear meaningful words when naming your classes. Create components when you can. Use prefixes for organization and search.
We encourage creating components inside your project. Components are defined as page elements that will, or may be, reused somewhere else on the site. For example, a newsletter signup, team grid, or a clients list.

.[components]_

When a class is specific to a component, we use a .[component]_ prefix followed by an underscore. The component keyword and underscore tells us the class style is specific to a recurring component that can be used site-wide.

What is a component? We define component as a recurring section/element/item that is, or can be, recurring on the website. This component may or may not be built into the symbol system of Designer.

If a client wants to create a new page, they can use the Client-first outer page structure + components to build it.

Use .[component-name]-component as the outer/master div holding the entire component. When possible, create a symbol from this element so clients can easily make updates to the component with override fields.
The nav menu seen on every page
.nav_component
.nav_logo-flex
.nav_links-wrapper
.nav_cta-primary
A recurring testimonial slider
.testimonial-slider_component
.testimonial-slider_name
.testimonial-slider_headshot-wrapper
.testimonial-slider_headshot-layer
The newsletter signup bar before the footer
.newsletter-form_component
.newsletter-form_field-wrapper
.newsletter-form_input
.newsletter-form_submit-trigger
The team grid list seen on About and Careers pages
.jobs_component
.jobs_name
.jobs_title
.jobs_location
The team grid list seen on About and Careers pages
.team-grid_component
.team-grid_name
.team-grid_title
.team-grid_headshot
The horizontal logo bar seen scattered throughout the build
.clients-bar_component
.clients-bar_logo-row
.clients-bar_logo
.clients-bar_rotation-trigger

.[element]-  or  .[style]-

Not everything is a component. There are some elements that are truly unique or relate to something more specific that is not within a component.

When a class is specific to an element or style, we use an .[element]- prefix. Note that the only difference is the underscore and the dash. Our classes that are not specific to a component will get a dash after the prefix keyword.
Form elements that are seen throughout the build and are not inside a single recurring form component.
.form-radio-label
.form-submit
.form-input-row
Shapes and accents seen throughout the build
.header-shapes-wrapper
.header-shape-1
.header-shapes-texture-layer
Background color css style that should remain global by class
.background-black
.background-gray
.background-blue
There are no hard strict rules with Client-first. Use your best judgement and make decisions that will be clear for others viewing your project.

Using keywords in class names

Be specific in naming

When creating new styles in your project, be specific when naming them. Class names, add-ons, and combos should be named in a way that gives the client the most context into what that class is doing. If a class name or group of class names is read, the reader should have as much information as they can about what the class' purpose is.

Keywords go from general to specific within a class name

Let's look at .space-top-small as an example

The most general keyword is 'space'. This is telling us those class has to do with spacing an element. This is the primary and most powerful keyword that defines the class name.

'top' is getting more specific and telling us where that space is being applied. It's telling us this is vertical spacing applied to the top of the element.

'small' tells us the size of the spacing that is applied to the top. This is the most specific keyword relates to the spacing applied to the element.
Let's look at .team_quote-headshot as an example

The prefix is 'team_', which tells us this element is on the team page of the website.

'quote' is getting more specific and telling us is in the quote section.

'headshot' is getting more specific and telling us that this is the headshot element within the quote section that is on our team page.

If we named this headshot element as .headshot, we would have no context into where that headshot is in our website or which headshot element it is.

Commonly used keywords

Use the same commonly used keywords so your build stays organized as you create custom classes. Formalizing keywords like 'list', 'item', 'container', 'wrapper', etc. will help us stay organized.
.page-... - Prefix to refer to a core page style that influences elements page-wide.
Use .page-wrapper to define the outermost 'wrapper' for our page.
Use .page-padding to define global left/right padding for all of our pages.
'section' - Keyword used to define an entire section of content.
Use .section as an organization wrapper for sections within a website.
'container' - Keyword for core page content width.
Use .container as a class that 'contains' items within a certain maximum width and centers the container on the page.
It's recommend this keyword stays reserved for this use only. Use 'wrapper' as a keyword for containing inner page elements.
'wrapper' - Keyword for wrapping or containing elements on a page. Wrapper is used for structure and non-content items.
Use wrapper to create a parent element that holds children elements. For example, if you need to have an image and a piece of text inside the same div, use the 'wrapper' keyword to define that div parent element. For example, 'profile-info-wrapper'.
'list' - Used for a div that is surrounding a grid or group of items. List is used for content items.
Use the list keyword for a grouping of items. If you have 10 people on your "Leadership" page, the div surrounding those items is the list.
'item' - Used for an item within a list.
Use the item keyword for an item within a list. If you have 10 people on your "Leadership" page, each person would be an item.
'card' - do we need card if we have item?
-
'layer' - Used for an element that is above or below other elements on the page.
Use for accents behind images, page textures, background graphic elements, etc. A layer is not something the user interacts with. It is a supporting graphic element for visual purposes.
.space-... - Used for spacing elements from each other on the page.
Applies margin-top or margin-bottom styles to elements to space them from one another.
.section-space-... - Used for adding equal inner space to sections.
Applies padding-top/bottom or padding-left/right to elements.

How to name and use Webflow dynamic lists

Dynamic List Wrapper = - Do not use the dynamic list wrapper for styles or naming
Dyanmic List = .whatitis-list - Add any styles you want
Dynamic Item = .whatitis-item  - Add any styles you want
Why no Dynamic List Wrapper?

We can not nest elements in the Dynamic List Wrapper. We are limited in what we can do with dynamic structures, and the Dynamic List Wrapper is unnecessary for any styling or layout you want to achieve. To create styles one level above your Dynamic List, add a div as a parent to the Dynamic List Wrapper and style the div as needed.

Using global classes, global add-on classes, and combo classes

What is a global class?

A global class is a class that is universal in the build. It is not specific to one element or one style. This class can be applied to any element and the styles will be applied to that element. This is commonly used for spacing, grids, global padding, and colors.

Changing a global class should be simple and powerful. One style change will update this global class globally across the website.

For example, .space-bottom-large has a margin-bottom of 60px. If your client wants spacing reduced across the entire website, you can update .space-bottom-large to 40px in one style change. This change will be seen site-wide everywhere .space-bottom-large is applied.

What is a global add-on class?

A global add-on class is a global class. It is an 'add-on' if it is added to an element in addition to other classes. It can be added to other classes on the website to add a style to an element.

For example, we have .container and it serves the purpose of creating the initial container structure. It gives you the option to define a default max-width to your container. If all or most of your website uses the same max-width, you can apply it as a default to the .container class.

If there are many different max-widths or you have one custom max-widths, you can use global add-on classes to manage your site's max-width.

This Style System comes with classes .max-128. max-480 .max-960. These can and should be customized for your build. Please be careful with using numbers on add-on classes. If you add .max-128 as an add-on class to elements across your site, and then you change the class name to .max-132, this change will not be seen site-wide. The add-on classes will not change along with the base class. Your site will now have a dead .max-128 class across your website with no styles applied to it.

.max-128 can be added in addition to .container to create a new style on the element. We get the base core of .container + a custom the max-width property for that section. We can change .max-128 to .max-132 to change this style site-wide.

.max-128 is a global class, which means it can be applied to any element on the site. It is not specific to use with containers. We can add .max-128 to a paragraph, title, or any element on our site. That element will have the max-width property without the unneeded base structure from .container.

What is a combo class?

A combo class is created as a variant to a base class. A combo class is used when there is a variation that needs to be added to a class that already exists.

The key difference between a global add-on and a combo is that a combo is creating a new class styling on the css stylesheet and the global add-on is not creating a new class styling on the css stylesheet.

For example, we have .section to define the primary sections of a page. We have useful global add-ons like .section-horizontal-large that we can add to .section to create inner padding. If our homepage hero has a unique style that doesn't fall into our global system, and is not recurring enough to create a new global class, we can create a new combo class.

For example, our homepage has a unique gradient background color, different spacing rules, and a special z-index. This is too much customization to try to fit into a global class system. We can create the new class styling .section .home-hero so we can customize our hero as needed. On this new combo class, we can apply all of the unique styles we want so our homepage hero.

It's important to know that this is created as a combo class instead of using .home-hero as a standalone class so we can share the styles of .section. Our .section class is still global and keeping it as the base class of the element gives us the ability to change its global style properties. For example, our .section class may have a z-index of 1 and position of relative. Now these styles can be used in our new combo class without re-writing z-index and position styles. If we needed to update .section to a z-index of 2, this would be applied to our new .section .home-hero combo class.

Another example of global add-on vs. combo

Global add-on class

.section  .background-blue .section-space-large
All three of these are global classes. They are not specific to one single element. Each one of these classes can be applied to any element on the website. When applied to any element, their styles will be applied.

Oftentimes global classes are created for commonly used styles on the site.

In this example, when these classes are applied together, they create a section with a blue background with 60px top and bottom padding.

You can use '.background-blue' on 20 items on the website and it will only be 1 single class styling on the css stylesheet.

Combo class

.text-small  .legal-disclaimer
Above '.text-small is our base class. '.legal-disclaimer' is a combo class to '.text-small' that creates a style specific to legal disclaimer text.

The '.legal-disclaimer' text is for one or several instances of text that applies a unique style on top of the styles of '.text-small'.

It's important to know that a combo class is created in this instance because we want to use the styles from '.text-small' when customizing for '.legal-disclaimer'

It's even more important to know that '.legal-disclaimer' can not be used alone. It can only be used as a combo class on top of 'text-small'

If you create 20 variations (combo classes) of '.text-small', you will create 20 new class stylings on the css stylesheet.

Never create combos from global add-ons

Never create a combo class styling from global add-on classes. This defeats our purpose of true global classes and can lead to organization issues as the website scales.

For example, if you create .section  .background-blue and  decide that this section needs an additional unique style, you should not create a new combo class out of these global add-ons.

Even if this combination of globals is only seen once on the site, a new combo class styling should not be created for this customization. For example, if you wanted the section to have borders, radius, background textures, height, etc., this should not be done to this group of global classes. These classes are global and we need to treat them like this.

Additionally, adding a new class name at the end of the class list is not recommended either. For example,  .section  .background-blue .home-hero is not recommended. This would create a unique combo class that would require both .section and .background-blue global classes to be present in order for the new .home-hero style to be shown. If you wanted to change the background from blue to black, your .home-hero combo class would not work. This is not organized and will lead to confusion.

It is recommended to create new combo classes for unique page elements. Do not stack many global styles.

Do not over stack classes. Do not over stack globals.

1 or 2 classes on an element
Great

3 classes on an element
Ok, but why?

4 classes on an element
Absolute maximum

5 classes on an element
Way too much


If you have a .section that requires styles that could fit into the global system, but would need 4, 5, or 6+ classes to make that happen, consider making a custom class from the beginning.

For example:
.section .background-blue .text-gray .section-space-medium

Yes, this is possible, and it will give you what you want. Once we start over-stacking classes, our elements becomes more difficult to manage.

If we need to swap .background-blue to .background-black, our task just became a pain in the ass. We have to remove each class that comes after it, change the background style, and then add the removed classes back.

Making this change is now more difficult and time consuming. Creating a custom combo class from the beginning will give us more freedom and speed to make changes to this element.

Consider moving global add-ons to a new structure on your site. For example,

For example:

.section .style-background-blue .style-text-gray
 
   .section-space-medium .home_hero


Here we nest our .section-space-medium spacing class on a new div inside our section. From there we can add our elements inside the spacing div. We now have two manageable layers - the outer managing background color and mobile responsiveness. The inner managing spacing between elements.

We also see the opportunity to add a custom combo style to our .section-space-medium. We can create .home-custom-mobile which creates 0 padding-top and 200 padding-bottom. This custom combo would not be logical if all globals were stacked on one div.

Never create combo classes from global add-ons.

Your site will become more difficult to manage if you create new combo classes with global add-ons.

For example:
.section .background-blue .space-top-small .home_testimonials  

Yes, this is possible, and it will give you what you want. Once we start creating combos with global add-ons, our elements becomes more difficult to manage. This new combo puts a new style on the element with the .home_testimonials add-on. This class must be applied in the same order as seen in the example. If any prior classes change or are removed, the .home-testimonials class no longer works.

If we need to swap .background-blue to .background-black, we just lost our work making the styles for .home-testimonials. It no longer works with the change to the black background. We will have to create a new combo class with the black background class.

Making this error wastes time and makes our website less flexible. Creating a custom combo class from the beginning will give us more freedom and speed to make changes to this element.

Create a fresh combo class.

It's recommended you make a fresh combo class right from the beginning.

For example:
.section .home_testimonials  

Instead of stacking global classes together or creating a stacked combo class, create the .home_testimonials add-on initially.

We can use .section base class for organization and base styles. Adding .home_testimonials on top allows us to add any custom or global styles to our section.

Solution for over grouping classes

Let's look at our base structure for most pages
.page-wrapper
.section
.container
.page-padding
...(e.g. grid, layouts, components, etc.)
We may want to add some spacing to our container element. We want to give it .space-top-large to create add margin-top to the container.

Now we have .container .space-top-large.

If this same container needs responsive spacing for tablet and mobile, we can continue adding spacing classes to this container. Now we have .container .space-top-large .tablet-top-small .mobile-top-large.

Now there are 4 classes on this div element. What if we decide to add a max-width to the container? What if the container needs something custom created as a combo class? We now have to remove all 3 spacing classes and remember which ones to put back after we make our container updates.

Instead of adding all spacing spacing classes to the container class, consider adding a new div that will hold all of the spacing classes. For example:
.page-wrapper
.section
.space-top-large
.container
.page-padding
...(e.g. grid, layouts, components, etc.)
Now our container element is doing what it's supposed to do and our spacing parent div is managing all of the spacing for the container. Viewing the .space-top-large class in the styles panel would show .space-top-large .tablet-top-small .mobile-top-large. The only reason you would need to edit this is element is if you wanted to change the spacing in this section.

Similarly, the only reason you would need to edit the container element is if you need to edit the container. Styles doing two completely different things are now separated, while remaining global and powerful.

Questions

ALL comments, suggestions, and notes about this Style System are welcomed

This is the SECOND iteration of the system. We must improve.

Questions? Talking points? Ask in Slack channel #stylesystem-chat

Let's talk about this as a team, figure out what works, what doesn't work, and iterate this build until it's ready to show the Webflow community.