0

I am trying to find a tutorial online or some advice in order to construct and name my class names in the css file or files, in a way to avoid frustration, enhance readability and re usability. Any tips or tutorials around?

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
themhz
  • 8,335
  • 21
  • 84
  • 109
  • 1
    Check this may be that's you want http://stackoverflow.com/questions/6222731/should-css-class-names-like-floatleft-that-directly-describe-the-attached-styl – sandeep Apr 23 '12 at 17:27
  • 1
    Also worth the look: http://twitter.github.com/bootstrap/ – Furunomoe Apr 23 '12 at 17:29

2 Answers2

5

Name your classes based on what kind of content they are rather than the styles being applied or their location. For example div.navigation is better than div.leftSidebar, which is better than div.grayBox.

For more information and examples, read this.

MALfunction84
  • 500
  • 3
  • 12
  • Thank you very much for you advice, I will accept your answer as correct since the link you provided game me the answers i needed. – themhz Apr 25 '12 at 10:10
2

It doesn't have to be difficult. Common sense will do. My rule of thumb is, if you want to give something a certain style, just think of the reason you want to do that and use that reason as a class name. If you want to make something bold because it's important, use class="important". Simple as that.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150