views:

132

answers:

5

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?

+4  A: 

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).

RichardOD
A: 

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.

Ian Devlin
A: 

Sounds strange, why would you want to add some kind of accessibility to an ID or Class name?

Oscar
A: 

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

Juraj Blahunka
+1  A: 

I prefer the all-lowercase-hyphen-separated approach.

This is consistent with how CSS properties are named: font-size, border-top, vertical-align, etc.

Craig