DEV Community

Discussion on: Why you should use semantic naming in CSS

Collapse
 
sargalias profile image
Spyros Argalias • Edited

Yeah perfectly good suggestion, thank you. You've got some good reasoning behind that.

At the end of the day you and your team will decide what makes the most sense to use.

There are two main motivations behind semantic class names:

  • The principle of least astonishment (the name is a useful, non-surprising label to the programmer).
  • Minimising future changes, because changing things is error-prone. A semantic name just happens to be the thing that is the least likely to change, compared to say color-red which could change all the time.

You've got the right idea to challenge the name. If you can find one that you think is most appropriate then by all means go for it :).

EDIT: Clarified about label being non-surprising.