08-18-06

  |   Permalink   Comments (0)

CSS Naming Convention for Classes and IDs?

Well, just re-reading some of the current bookmarks in my bag. To note,

I am trying to clean up and make things more efficient here at work. One goal would be to have a base CSS that will serve as a starting point for our Producers and Frontend peeps. Another goal would probably be a convention on how to use it and/or create new classes and IDs.

One of the things that keeps coming up lately would be the naming convention of classes and IDs. I used to implement this kind of format “class_name”. Then, only to switch to “class-name” in early ‘06. Fast-forward to a couple of months into the year during a project, I came to find out that if you are referring to either a classname or an ID (i.e. getElementById, or something like that) that the value’s hyphen get stripped out. Can someone confirm this phenomena and/or myth? That is, for example, doing “id-name” would be implemented like so:

document.getElementById("idname")

With that however, would it be more readable using a camelCased name? Although against Tantek’s step #4 in terms of saving the user(s) potential headaches. But would there be problems if there was a standard within one’s organization? That is, classes and IDs written as a variable, i.e. somethingLikeThis; no hyphens and no underscore.

I look forward to hearing your endless wisdom on this subject sirs and madams. Thanks in advance.


Posted at 12:15 PM in code, code» css
Tags: css, naming, name, convention, standards
comments:
No one has made a comment on this entry. Posting one is currently disabled.

^top
search this site
entries control
« Previous
Pudding, The Cream Cheese Filler

» Next
Cat, Kancho and Japan
calendar
August 2006
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
posting a comment is currently disabled for this entry
your name:


your email: (only for admin purposes)


your website/url: (optional)


your comment:


 remember my info?

current playlist
  • Chord Memory (Daft Punk Remix)
    Ian Pooley
  • Mothership Reconnection (Daft Punk Remix)
    Scott Grooves
  • Human After All
    Daft Punk
  • Technologic
    Daft Punk
  • Robot Rock
    Daft Punk
  • Something About Us
    Daft Punk
  • Harder, Better, Faster, Stronger
    Daft Punk
  • One More Time
    Daft Punk
  • Rollin' & Scratchin'
    Daft Punk
  • Alive
    Daft Punk
random snapshot

life is...
help me, help you




Basecamp project management and collaboration

Blingo

for your information
powered by