The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> CSS Help
|
CSS class identifiers
Discuss CSS class identifiers in the CSS Help forum on Dev Shed. CSS class identifiers Cascading Style Sheets (CSS) forum discussing all levels of CSS, including CSS1, CSS2 and CSS Positioning. CSS provides a robust way of applying standardized design concepts to your web pages.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

August 31st, 2001, 10:36 AM
|
|
Contributing User
|
|
Join Date: Feb 2001
Location: USA
Posts: 830
Time spent in forums: 3 h 17 m 56 sec
Reputation Power: 13
|
|
|
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
|
|
Senior Meddler
|
|
Join Date: Dec 2000
Location: NY NY USA
Posts: 142

Time spent in forums: < 1 sec
Reputation Power: 13
|
|
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:
Quote: 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
|

August 31st, 2001, 12:00 PM
|
|
Contributing User
|
|
Join Date: Feb 2001
Location: USA
Posts: 830
Time spent in forums: 3 h 17 m 56 sec
Reputation Power: 13
|
|
|
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
|
|
Senior Meddler
|
|
Join Date: Dec 2000
Location: NY NY USA
Posts: 142

Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
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
|

September 2nd, 2001, 10:29 AM
|
|
Junior Member
|
|
Join Date: Aug 2001
Location: Rotterdam, Netherlands
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
returning the favour (or something like that)
Check out URL
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)
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|