DEV Community

loading...

Discussion on: What's your favorite CSS approach?

Collapse
itmayziii profile image
Tommy May III

Utility CSS frameworks are my favorite but I understand why it turns some people away. My second favorite approach is BEM with light use of SASS to make the nesting clear. If I see things like functions in SASS I consider that to be too much for my taste.

The main benefits of utility first CSS for me is:

  1. Your CSS files tend to not grow very large because you reuse the same code over and over.
  2. Everything has the same specificity. This point can not be overstated. I have ran into so many codebases where I have to write some ridiculous CSS that just adds mental fog for everyone that reads it because I have to override that ul > li + a.some-class selector.
  3. No more trying to make generic class names that mean nothing like .container just so you can reuse it in multiple places and still have the class make sense.

I understand this is a holy war, and I'm really not trying to argue with anyone today, tomorrow, or the next day. All the approaches of writing CSS can be made to work.