I have seen some developers write
HTML:
some content
CSS:
the style will be applied only when the class is applied to a div ?
there are some performance implications too.. here is the performance counter
As for which one to use, use whichever is most appropriate. If you have a search box on your page then using an ID for that would be most appropriate because there's only one search box. Table rows on the other hand will probably be identified by class because there is (or can be) more than one.
something that most ppl dnt pay attention to is semantics while naming a class.. read this blog for some nice tips: http://css-tricks.com/13423-semantic-class-names/
Sorry I wanted to add One important thing to remember about how browsers read your CSS selectors, is that they read them from right to left. That means that in the selector ul > li a.home the first thing thing interpreted is a.home so avoid making such mistakes