#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14

    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.
  2. #2
  3. No Profile Picture
    Senior Meddler
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    NY NY USA
    Posts
    142
    Rep Power
    15
    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 CSS2, identifiers (including element names, classes, and IDs in selectors) can contain
    only the characters [A-Za-z0-9] and ISO 10646 characters 161 and higher, plus the
    hyphen (-); they cannot start with a hyphen or a digit. They can also contain escaped
    characters and any ISO 10646 character as a numeric code (see next item). For instance,
    the identifier "B&W?" may be written as "B\&W\?" or "B\26 W\3F".
    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).

    hth,
    bob
    --
    Bob Boyle
    boyleb@rappdigital.com
    www.rappdigital.com
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14
    Shouldn't that or the equivalent be in the CSS1 specs? Thanks alot Bob, exactly what I was looking for.
  6. #4
  7. No Profile Picture
    Senior Meddler
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    NY NY USA
    Posts
    142
    Rep Power
    15
    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.

    shrug,
    bob
    --
    Bob Boyle
    boyleb@rappdigital.com
    www.rappdigital.com
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Rotterdam, Netherlands
    Posts
    1
    Rep Power
    0

    returning the favour (or something like that)


    Check out www.htmlgoodies.com

    The guy there (Joe Burns)

    Has a lot of information and tudors on cascading style sheets, dynamic html, JavaScripting and all that stuff.

    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)

IMN logo majestic logo threadwatch logo seochat tools logo