The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS IDs vs Classes Re: IDs vs Classes


ID is used to define a single object on the page. Class is for classifying certain objects. (is this too technical? I feel like a know-it-all).

Myself, I use ID mostly as a js selector, but I will style by id when I have one. But really if you have a single object on a page with a certain purpose like “main-menu” that could have a unique ID. It could also have a class of “menu”. say you want all your menu links to be the same color but the main menu is sized differently:

#main-menu {

.menu a {color:red;}