Practical considerations for HTML / CSS naming conventions (syntax)
- by Jeroen
Question: what are the practical considerations for the syntax in class and id values?
Note that I'm not asking about the semantics, i.e. the actual words that are being used, as for example described in this blogpost. There are a lot of resources on that side of naming conventions already, in fact obscuring my search for practical information on the various syntactical bits: casing, use of interpunction (specifically the - dash), specific characters to use or avoid, etc.
To sum up the reasons I'm asking this question:
The naming restrictions on id and class don't naturally lead to any conventions
The abundance of resources on the semantic side of naming conventions obscure searches on the syntactic considerations
I couldn't find any authorative source on this
There wasn't any question on SE Programmers yet on this topic :)
Some of the conventions I've considered using:
UpperCamelCase, mainly as a cross-over habit from server side coding
lowerCamelCase, for consistency with JavaScript naming conventions
css-style-classes, which is consistent with naming of css properties (but can be annoying when Ctrl+Shift+ArrowKey selection of text)
with_under_scores, which I personally haven't seen used much
alllowercase, simple to remember but can be hard to read for longer names
UPPERCASEFTW, as a great way to annoy your fellow programmers (perhaps combined with option 4 for readability)
And probably I've left out some important options or combinations as well. So: what considerations are there for naming conventions, and to which convention do they lead?