To be completely honest, it comes down to individual developers and their own feelings. There are two equally good ways to structure CSS classes, just like you:
.profile.image.large{ width: 300px; } .profile-image-large{ width:300px; }
They achieve the same, but when you start to think broadly, you see how wide the difference between these styles is.
Separating classes makes them reusable: DRY - never be repeated. Separating the large or image classes, we can reuse the same class:
.blue{ border: 3px solid blue; } .profile.blue{ border-style: dashed; }
In the second approach - using separators - , the code will look like this:
.blue{ border: 3px solid blue; } .profile-blue{ border: 3px dashed blue; }
In a simple example, such as border , this does not seem to matter. But consider a much larger piece of CSS that you might want to reuse dozens of times throughout your code. You will repeat a lot.
Logically grouped styles are still good: I'm not saying that -classes is bad, they help determine the namespace for your code, so in terms of maintaining modular code, a prefix of styles with an identifier will help prevent conflicts, especially if you are developing code inside the web - an agency that will be reused, or if you are creating a plugin (in this case, a style prefix is ​​absolutely necessary).
Developing in a compiled language like SCSS (my preferred environment) changes the way you think. In SASS / SCSS, we can easily do this:
.profile{ display: block; &-image{ border: 1px solid blue; } }
And this is evaluated in the same way as the profile profile-image for an element. Alternatively, SASS also supports:
.profile{ display: block; &.image{ border: 1px solid blue; } }
What evaluates the profile image for an element. Very similar, but both styles are limited to the parent element .profile and cannot be used globally. The styles are protected, whereas in my first “natural” CSS example, the blue class can be freely added and included with the any element on the HTML page.
Edit: you can still use the global .image style in your SASS code and then redefine individual examples, but I personally feel that this violates the DRY principle, and I try to avoid it whenever possible.
So what is TL; DR?
In my opinion, there is no “right answer”. In terms of conventions, it’s worth noting that structures like Twitter-Boostrap use a hybrid of two styles — global classes that can be applied everywhere, mixed with prefix classes that protect their children's styles.
The most important thing for any programmer is that your code is read and defined, and you use as little code as possible to achieve your result - no matter what method you use.