[Javascript] using multiple class names

Mike Dougherty mdougherty at pbp.com
Wed May 26 08:32:35 CDT 2004


Thanks, the essay answer is exactly what i was looking for.

One more thought on this not-exactly-javascript topic:

I'm already naming most of my objects with Id attributes.  Are there any caveats against using the 
id reference in CSS? ex: #ID1 {*style*}  This formatting is not DHTML (en/dis-abled, etc.) so it 
won't need to be referenced dynamically.  So rather than using a class name with only one member, 
I figured I could just use the #ID syntax.  I did see a reference to this being "limited" somehow, 
but it wasn't explained why.  Any thoughts?

>Obviously if two attributes always go together (small white or large red), there's no point in 
>splitting them into two separate vectors.
>
>On the other hand, if you have exactly one attribute for each class name, it becomes arguable 
>whether there's any point in encapsulating them in class names...  the justification being to 
>mark up the HTML metaphorically so you can detail it with various specificity in CSS.
>
>In a sense, you're merely extending HTML which provides similar tags with <big>, <strong>, <h1>, 
><h2>, etc.
>
>All that said, there's a good argument made that you should name your classes by their purpose in 
>your project (prompt, error, caption, headline) rather than by their attributes (size1, color2) 
>so that as your presentation changes in the future you aren't left with nonsensical classes such 
>as:
>         .size1 {font-weight: bold;}
>That is, design first for structure and meaning, then paint your presentation wholly with CSS.



More information about the Javascript mailing list