Hey there,
I’m trying to find a CSS naming convention other than the BEM, I’d prefer something shorter and quicker without as much typing for the CSS class names.
Does anyone know of any other CSS class naming conventions which are quicker/ more effective?
Teams have different approaches to writing CSS selectors. Some teams use hyphen delimiters, while others prefer to use the more structured naming convention which you mentioned - called BEM
Generally, there are 3 problems that CSS naming conventions try to solve:
To know what a selector does, just by reading its name
To have an idea of where a selector can be used, just by looking at it
To know the relationships between class names, just by looking at them
A lot of CSS frameworks use a non-semantic naming convention which generally describes how the element should look, this can get confusing. Below is an example:
What you’re looking for is something more readable and practical, something that’s unique to that element and easy to write. As Jeff mentioned, thats where a semantic naming convention comes in. Here is an example below: