Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Naming conventions for html/css + MVC?

Are there any good articles on naming comprehensive naming conventions?

I'm looking to clean up some code... everything from assets to models (Codeigniter) to HTML and CSS.

I'm also curious how to structure the CSS... is it better to give everything a unique class ie search-bar-icon or is it better to repeat classes like .search span.icon {?

Thanks, Walker

like image 870
Walker Avatar asked Sep 10 '26 22:09

Walker


1 Answers

In HTML/CSS, the id and class selectors are not equivalent. The id carries more weight, so it should be used sparingly. Use it for sections of a page where you have descendant selectors whose class names are the same as other sections but you wish them to be styled differently. Think of the id like a poor man's namespacing for page regions.

like image 181
Robusto Avatar answered Sep 12 '26 10:09

Robusto