Forums

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

#105272
Senff
Participant

Technically, if they’re all unique, it doesn’t matter. Semantically, maybe a little. For example, you could give both menus the class “menu”, and then one has ID “main-menu” and the other “additional-menu”.

In essence, if there are elements on the page that share some properties, then bundle those properties in a class and assign that class to those elements.
But if the look/functionality/structure of all those elements is all unique anyway, go ahead and use IDs as much as you want, I guess.