CSS Naming Convention
- Started
- Last post
- 8 Responses
- zackgilbert
Hey. I'm looking for a good naming convention for css. Anyone know of any good resources to look at? I know naming conventions are always controversial, but I'd like to establish one thats intuitive. Thanks.
- zackgilbert0
anyone? bueller?
- heavyt0
i dont think that there is one. I have read all of Eric Meyer's books, and zeldman, and 37 signals, but they never discussed it.
TR1
- zackgilbert0
that might be why i really cant find anything good out there on it. was hoping that there was someone out there that had taken the time to figure out something intuitive. im putting together a template site for a client and want to make all the id and class names so that its super easy for the client to use and figure out. id really like to stay away from having a complex systematic convention and having to map everything out for them.
- zackgilbert0
thanks though, heavy.
- heavyt0
i think that the bes tthing to do is make it contextual. so, you may call it ".homepage text".
TR1
- zackgilbert0
yeah. thats what im thinking too. the old version my company used to do was really had to follow unless you had a map/legend infront of you and was obviously made by someone who didnt know/use css. so im trying to actually figure out a good way of doing it. contextual is definitely the way to go, just trying to figure out the rest of it.
- spiralstarez0
just go grab the stylesheet and markup from http://www.csszengarden.com and play with it.
a good pointer is to never name something based on what it looks like, name it based on its function instead.
also, it's good to name things very verbosely I find (csszengarden) and then get used to using "find" and "search and replace" in DW or your text editor will save you hours and hours of sifting through code.
- zackgilbert0
thanks! ill definitely take a look at their convention. see how they handle things.
and yeah, i usually use a flag system for find and replace. makes things a lot easier.
thanks guys. its good to know that i was on the right track with this stuff.