4 ms·
Not using CamelCase makes this CSS very hard to read. For example: <div class="box profile profile--is-pro-user"> So I don't get the advice of using hyphe
by huuu 12y ago
Not using CamelCase makes this CSS very hard to read. For example:
<div class="box profile profile--is-pro-user">
So I don't get the advice of using hyphens only. To me this is more readable:
<div class="box profile profile--isProUser">
- Danieru 12y agoIs there a chance you mostly program in languages where camelCase is common? For me as a C programmer / Javascript programmer both are readable. I think hyphens are useful in css to keep the namespace non-confusable with the javascript.
- moron4hire 12y agoThat's actually where I mix the two uses. CSS class names, I use hyphens, because what CSS calls a class is not the same thing as what Javascript calls a class. DOM element IDs, I use camel case, because it's likely to also be the variable name I use on the Javascript side to hold the reference to the DOM element.