What is the standard naming convention for html/css ids and classes? [closed]

Does it depend on the platform you are using, or is there a common convention that most developers suggest/follow?

There are several options:

  1. id="someIdentifier"' – looks pretty consistent with javascript code.
  2. id="some-identifier" – looks more like html5-like attributes and other things in html.
  3. id="some_identifier" – looks pretty consistent with ruby code and is still a valid identifier inside of Javascript

I was thinking #1 and #3 above make the most sense because they play nicer with Javascript.

Is there a right answer to this?

7 Answers
7

Leave a Comment