|
Stop guessing about what is a valid name for a new CSS class, a JavaScript variable, a PERL function or any other identifier! Use the common, shared set of rules for those languages. It could not be any easier. Print out that article and keep this valid reference handy for the most important languages on the Web. Web masters, Web designers, and programmers do not have an easy job, when it comes to update templates, files, and programs for a Web site. In most cases they will have to build on "code" that has been written by somebody else. Furthermore there are many different languages that have rules of their own. * HTML, XHTML, XML
Sometimes the differences are minor, but the interpreter, browser, the code validation tool will complain, if the syntax of a particular language is violated. We humans tend to overlook the subtle differences between languages. A computer does not. 1. Characters you can use safely Use only the following ASCII characters for your identifiers, variables, and functions names. [ABCDEFGHIJKLMNOPQRSTUVWXYZ] -> [A-Z] The beauty about the old-fashioned ASCII character set is: All ASCII characters are available on any computer platform in any country in any language setup. Even though current standards allow the use of a wider set of characters in most cases, restricting it to the ASCII subset avoids problems with older or badly configured operating systems, servers and browser and different regional/language setups. 2. Case-Sensitivity Most identifiers are case-sensitive according to the language specification, that means "Web-site" is different from "web-site". Some are not. For example, note in particular that element names are case-insensitive in HTML, but case-sensitive in XML. To avoid potential problems and ambiguity type the identifiers always in exact case, but treat them as they were case-insensitive. Here is an example, do not use "Manual" and "manual" as two different identifiers. You could mix them up too easily, and "buggy" software could mix them up, too. 3. HTML, XHTML ID and NAME Tokens For Example:
* No spaces
4. CSS Class Names HTML:
|