I don't think you will ever find a unified agreement on the way naming conventions are used. Even after a couple of replies, you can clearly see that even people promoting web standards can use different styles.

The only advice I can really give is be consistent, or you'll just end up confusing not just yourself, but anyone else who has to look through your code.

I would recommend that one of the following would be most useful (for popularity, and understandability):

PascalCase - generally used more for Object/Class declarations (especially in Java, PHP etc)

camelCase or underscore_style - probably the two most used styles. Used for creating variables, functions etc

UPPERCASE_UNDERSCORE - prob best to stay clear of this in general usage, but useful for identifying constants, and globalised variables.

I would steer clear of the following:

Hungarian Notation - usually seen as oMyObj - using an initial identifier to show the type of variables ([o]bject, [i]nt, [s]tring etc), in practice however, it can be very confusing.

hyphenated-style - similar to underscore_style - unlike the others, this style is not universal (eg. cannot use in PHP). As css uses this style for naming its properties, it might seem like a good idea... but avoid if possible.

As I said, the main thing to consider is consistency, even within different languages... adopting a single style for css, javascript, php etc will make your code much more understandable for you and others (its very time wasting to be half way through coding, and then realising you've used your php style in javascript etc).

Thanks,

David.

tee g.peng wrote:
Good evening and good morning!

I remember reading an interesting thread about using lowercase for CSS element naming, but I can't seemed to find that thread from mail- archive. Vaguely I remember it was something about xml wellformness - before reading that thread, I used to use lower uppercase names, and thought it was just one's preferences.

I have tried to pick up good habit since I read the thread. Was reading CSS Mastery, Advanced Web Standards Solution by Andy Budd, and it got me confused a bit. The author used lower uppercases for examples throughout the entire book. I crossed check with other CSS books I have, they all used lowercases and the only exception is in More Eric Meyer on CSS, the last chapter, project 10, Designing in the Garden, I said it was an exception because that project was for CSS Zen Garden that the code could not be altered.

Not trying to stir up anything here. I simply want to learn the correct way, since that the book titled itself 'Advance Web Standards Solutions' therefor I would like to confirm what I learned from that thread is the 'correct' way, or rather, there isn't anything right or wrong as to how one names his CSS.

Thank you!

tee


******************************************************
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************






******************************************************
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************

Reply via email to