BEM vs Client first. Which one should I use?

Granite Marketing
April 3, 2024
5 min read

Table of Contents

Client-First vs BEM, which to use? If none of this means anything to you, and you’re building websites, then this post is even more important for you and your clients!

We're going to cover the following points:

Introduction to BEM

BEM stands for Blocks, Elements, and Modifier, and it began it’s rise in 2006 as a means to manage large projects:

  • Block - The name of the group of elements eg nav
  • Element - The name of the element eg link
  • Modifier - The name of the modifier eg current

Together this produces code that looks something like this nav_link--current, although there are various versions depending on preference. Below you’ll see an example of a homepage banner element created using BEM. This is representative of a typical layout as well as an alternative style modifier on the button (Figure 1).

Figure 1. Example of BEM naming convention for a home banner element

Introduction to Client first

Client first is a modification of BEM that was developed by Finsweet to adapt the BEM approach to work better with Webflow websites. It follows an approach that looks something like component_[element-name] but it also focuses on having global utility classes like padding-global, margin-large and so on.

To add style modifiers, it uses classes like is-blue

The typography naming system and spacing systems are also component-based so you’ll often see things like text-size-[size], text-color-[color] or [padding-direction] + [padding-size] used together.

When styling blocks, it's structure does resemble BEM - as you’ll see in the hero block in figure 2. There’s more to the system but these are the fundamental features required to grasp the basic concepts.

Figure 2. An example of what figure 1 would look like in a client first approach

Advantages and disadvantages of Client-first and BEM

Benefits of BEM

BEM enforces purposeful naming

BEM is great for dealing with SCSS/SASS since the nested page elements follow a chronological structure, as you can see in figure 3. It creates a clear relationship between the whole homepage banner and it’s child elements. You can then manage them in a single file, like _home-banner.scss, making change management easy.

Figure 3. Home banner SCSS file code example

Global styles can be defined in a separate SCSS/SASS file, like the container class in figure 1, and you modify sizes, spacings and colours by styling the block, elements and modifiers.

It's very flexible

BEM puts you in charge of defining your class names and their properties. There's also a few different implementations so you can choose one that better suits your preferences. Learning a framework can slow down development until you become proficient.

Disadvantages of BEM

It can lack semantic meaning

BEM is great for writing code, however clients get no semantic information from the class name alone eg home-banner__title tells the client it’s a title but it doesn’t tell us about its size, colour or weight to name a few properties. Having said that, we've never worked with any client who's wanted to update the frontend themselves so this isn't a major drawback.

Lazy class naming

The flexibility of BEM can also be it's biggest drawback. Since there are a few different implementations and you're in charge of defining class names, it's very easy to run out of ideas and to create duplicate stylings. Sticking to a singular implementation and reviewing designs for repeating elements can usually circumvent this issue.

Advantages of Client-first

It's component-base approach

Since Webflow empowers clients to mange the websites themselves, it can be helpful to know the function of each class just by reading their names. Additionally, if you set up a page with all your components, the client can update it once and it’ll change all styles throughout the website.

This system is good, particularly when scaling projects and when collaborating with multiple, non-technical stakeholders. It does require some setting up but there is a clonalable to help get things started!

It has clonables

The Client-first clonalable also has some custom code which makes your websites page elements stay the same size, and aspect ratio, if you change the browsers width. This is all done with accessibility in mind and it's vitally important for more complex layouts.

Drawbacks of Client-first

Excessive element nesting

The major issue with Client-First is div soup, a phenomena which occurs when elements have several wrapping divs just to display a piece of text. The library itself if also quite large which can slow down your website. Having a high HTML to content ratio is bad for your SEO, and larger CSS files can slow down your website and also negatively impact SEO performance.

It's very, very bullky

The real power of client first comes from it's style guide, particularly the headings and buttons. Having spacing utility classes is nice, but accessing their full capabilities means limiting yourself to standard SAS-like brochure websites since it can't cover all use cases.

So website layouts that are more adventurous often find themselves at a loss due to the extra CSS utility classes which aren't being used.

Alternatives to BEM and Client-first

The Saddle framework

The Saddle framework aims to mix the flexibility of BEM with the utility of component-based libraries like client-first. It's advantage over client first is it's more lightweight and it grants BEM-like flexibility when defining layouts. Additionally, the naming convention looks cleaner since they took inspiration from tailwind.

The MAST framework

Like saddle, MAST intends to empower users with flexibility whilst reducing the bulkiness of the framework. It even provides guidance on mindset in order to negate some of the drawbacks of BEM that we discussed. Saddle also used mast as inspiration for their framework so there are several similarities.

Conclusion

Having used both approaches now, I’m leaning towards favouring Client-First for Webflow projects. This decision is aided by the fact you can clone the Client-First components from Finsweet and get things up and running quickly.

The classes are easily understood and you don’t get undesired results from adding combo classes, since a lot of the styling is handled by clearly defined global components.

I still find BEM superior when writing code with SCSS/SASS because its very easy to nest your styes, in a chronological format, in the one file. To use client first, without webflow, you’d often find yourself jumping between different files, or navigating to multiple locations within the same file, just to change the spacing, or weight, of a single element.

A well configured list of SCSS variables, mixins and global CSS styles can almost entirely eradicate the need for component-based SCSS/SASS. Or you can use a library like tailwind to easily add semantic global components.

References

Finsweet Website

- https://finsweet.com/

Client first

- Client first clonal link

BEM

- BEM link

Tailwind Css

- https://tailwindcss.com/

Share this post
Fin Attributes
Webflow
Granite Marketing
Company

Let's Work

Ready to automate your workflow and simplify website change management? Get in touch today and lets see if we’d be a great fit. If you prefer to keep it old school then you can send us an email instead. Still not convinced? Check out our projects.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Frequently Asked Questions

Unfortunately we don't. Webflow templates are great to test proof of concept or to get something that looks nice up and running quickly. Developing a unique creative direction, embedding scalable systems that consider the growth trajectory of a business, and creating robust design systems are constrained when using templates.

Webflow websites typically take between 4-6 weeks to develop. This includes time for discovery, strategy, design and development. If you already have a design and your just need white labelled implementation, that timeline can be shorted to around 2-4 weeks depending on complexity.

We prefer to design websites using Figma due to it's extensive collaboration capacity and robust plugin library. We develop exclusively with Webflow, and have a proven track record of integrating APIs and no-code solutions to extend the functionality of websites.

Yes we do offer SEO services. We can support with on-page SEO, off-page SEO and creating a clear SEO strategy to help your website rank higher in Google.

This depends on the size and scope of the project, and every quote is tailored to your requirements, capabilities, and timeline. Please note that our minimum engagement level is £2000.