A Balanced Look at Tailwind vs. BEM

Eric Bailey has published a thoughtful comparison of Tailwind and BEM over at thoughtbot, and the piece is being praised for the evenness of its treatment. Rather than treating the two approaches as a winner-takes-all contest, it lays out the upside and downside of each in well-considered bullet points that hold up on inspection.

The case for and against Tailwind

On the benefit side, Bailey notes that the utility CSS approach gives developers an API-style way of thinking about CSS, which helps many people work with it. Against that, adopting Tailwind means learning its class names in addition to CSS property names in order to arrive at the visual styling you want. The drawback continues: Tailwind depends on CSS and will be outlived by it, so focusing directly on CSS's capabilities pays off more in the long run.

The case for and against BEM

BEM, by contrast, lets you describe any UI component you can imagine in a flexible, extensible way. Because it is an approach for encapsulating the full range of CSS properties, it can style things Tailwind simply has no classes for, such as highly art-directed experiences. But BEM runs headfirst into what is often called one of the hard problems in computer science, naming: you must describe not only your component but also all of its parts and their states.

Other options exist

Neither approach is the only option available. Other styling methods have been compared and catalogued separately for anyone weighing further alternatives.

CSS-Tricks star logo