Semantic class names: are you being too generic or too specific?

View the original post

Even if you’re completely sold on semantic class names and avoid stylistic and behavioural class names altogether, choosing a good class name is hard.

The problem boils down to naming your classes either too generically or too specifically. Both of which have pros and cons. But I like to think we can choose a class name without any cons. Let’s see.

Most developers I’ve worked with tend to use overly generic class names. There’s a tendency to do this because—at least in theory—the more generic something is the more reusable it is. But for CSS this isn’t really the case.