August 31st, 2001, 10:36 AM
CSS class identifiers
Does anyone know or know where to find naming rules for CSS class identifiers? This doesn't seem to be addressed in the W3 CSS documentation.
August 31st, 2001, 11:53 AM
It is -- you just need to know where to look.
The rules on naming classes, or any other selector that can take a "author-assigned" name, come under section 4 of the specs on CSS2 Syntax and basic data types ... in particular, in section 4.1.3. The most important bit of info there is:
In other words, it's best to stick with letters, numbers, and the hyphen. Unlike CSS2 keywords, property names, or pre-defined selector names (such as an HTML element selector like 'body' or 'BODY'), identifiers are case sensitive--so your use of case must remain consistent throughout your document(s). And although some browsers will let you get away with it, don't start a class name with a number (or a hyphen, for that matter).
August 31st, 2001, 12:00 PM
Shouldn't that or the equivalent be in the CSS1 specs? Thanks alot Bob, exactly what I was looking for.
August 31st, 2001, 12:12 PM
According to Eric Meyer's CSS2 reference by Osbourne, yeah it should be. He doesn't have much to say about it other than the thing about numbers ... and he's wrong about it. He mentions that CSS1 prohibited starting with and number but that CSS2 allows it, but the text I quoted above states quite clearly that they still aren't allowed, whether browsers allow them or not.
September 2nd, 2001, 10:29 AM
returning the favour (or something like that)
Check out www.htmlgoodies.com
The guy there (Joe Burns)
The texts are easy reading, and all do he doesn't go extremly deep into subjects, if youre ad the end of the story, u should know pretty much everything about css, and all the stuff I mentioned. He teaches you the how to's and you wrap them up to superscripts yourself, check it out.
(If you havent' already that is). (And i posted reply's to your suggetions on my thread)