Previous Message
Next Message

Re: [css-d] CSS Methodologies

Sent by Anders Nawroth on 23 July 2003 23:11


Alex Jones wrote:
> Style Naming Convention
> 
>   - Do not start an ID or class with a digit or use underscores as they 
> may not work in all browsers.

The spec. says:
<cite>
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.
</cite>

Underscores shouldn't be used AT ALL in CSS identifiers, they are not 
standards compliant. Hypens are a nice alternative to make the 
identifiers more readable.

>   - Classes and IDS should never be an adjective or infer placement as a 
> future redesign may not place the item in the same spot, or use the same 
> background color. So, instead of using an ID of "TopBox", use an ID 
> specific to its contents, perhaps "GlobalNav".

This is a very good point, IMHO.
It separates presentation from content even more, and gives you 
identifiers that make sense.


/Anders

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: