Here is a list of minor things about the naming schemes of CSS classes, files and URLs which I've accumulated over the years. Some may be outdated, but nonetheless they were issues found over the course of the last decade of web development:
- Back in the Netscape days, some of the versions did not play well with underscores. This meant that underscores were specifically avoided to prevent CSS issues associated with Gecko browsers. This may not be an issue anymore but it is still avoided for SEO purposes.
- GOOD: <A CLASS="db-item">
- BAD: <A CLASS="db_item">
- Search engine optimization methods suggest using hyphens over underscores for both CSS classes and files.
- GOOD: <A CLASS="db-item1">
- BAD: <A CLASS="db-1">
- In the past, older, legacy servers weren't able to differentiate upper and lower case letters. They would call upon the same file regardless of case. This problem has been “fixed” and therefore, it opens up the possibility of having two different files named “test.jpg” and “Test.jpg”. I highly recommend filenames and URLs containing only lower case. Domains can never be case-sensitive, so why complicate this procedure by introducing capital letters into the URL? Does it make things easier for a user to remember the word AND casing?
- Classes as contextual information. Naming classes based on a visual aspect “middle-column” has always been frowned upon because CSS is supposed to separate presentation information from the HTML. Instead, class names that describe the component or information works far better.
- GOOD: "breadcrumb" or "main-content"
- BAD: "left-column" or "font-size12"
When it comes to web development on large-scale projects, I firmly believe in simplicity and consistency. When a decision has been made on the naming schemes, however wrong it may be, it's best to stick with it. This is a more pragmatic approach because it addresses several things:
- Developers will always need to work within some sort of limitation.
- As a developer, you probably weren't brought onto the project to re-code existing work.
And to be completely frank, if ever you *are* brought onto a large-scale project, the naming scheme should be the least of your concerns.