Reputation: 1165
I am now in charge of refactoring HTML and CSS for the site of my company. As I have seen the current CSS code, it is following naming convention for IDs and Classes (camel Notation). But, last week I did the demo to everyone in the office; then one guy expressed an idea about using underscore or dash between the names that contain more than one word because he mentioned about the accessibility of SEO to the page. In this case, I don't know for sure if his idea is useful. Does anyone have idea around this?
Upvotes: 1
Views: 312
Reputation: 8913
this is an interesting issue.
is if it's of any use, seems that microformats suggests the lowercase-hyphen approach
http://microformats.org/wiki/naming-principles-faq
Upvotes: 0
Reputation: 4383
I prefer the all-lowercase-hyphen-separated
approach.
This is consistent with how CSS properties are named: font-size, border-top, vertical-align
, etc.
Upvotes: 2
Reputation: 18523
Well, when you see all the hype about SEO, even class and id names do count in the SEO optimization, therefore i choose hyphen/underscore over camel case
Upvotes: 0
Reputation: 18870
Personally I tend to use a small letter at the start and then capitals, e.g. .userImage
I can't remember when I adopted this approach or why though! Like Richard above, I don't see how the naming of CSS ids and classes has anything to do with accessibility.
Upvotes: 0
Reputation: 29157
The man himself (Eric Meyer) frowned upon their use years ago. Personally I'd favour a initial cap approach. I don't see how this could help accessibility.
I'm sure it makes little difference what you choose as long as you are consistent (as long as it is valid of course).
Upvotes: 4