CSS naming guildlines with elements with multiple classes

Posted by ryanzec on Programmers See other posts from Programmers or by ryanzec
Published on 2012-11-09T20:20:38Z Indexed on 2012/11/09 23:22 UTC
Read the original article Hit count: 360

Filed under:
|

Its seems like there are 2 ways someone can handle naming classes for elements that are designed to have multiple classes. One way would be:

<span class="btn btn-success"></span>

This is something that twitter bootstrap uses. Another possibility I would think would be:

<span class="btn success"></span>

It seems like the zurb foundation uses this method.

Now the benefits of the first that I can see is that there less chance of outside css interfering with styling as the class name btn-success would not be as common as the class name success. The benefit of the second as I can see is that there is less typing and potential better style reuse.

Are there any other benefits/disadvantages of either option and is one of them more popular than the other?

© Programmers or respective owner

Related posts about coding-standards

Related posts about css