Forums

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

Home Forums CSS CSS Class and Id Reply To: CSS Class and Id

#240331
Atelierbram
Participant

Reasons why it is common practice now to use mainly classes in CSS is the extremely high specificity of ID’s, which makes it harder to override declarations set before. ID’s are also unique, and classes are not, so this makes classes more versatile, also because there can be multiple classes on one element in HTML.

ID’s can be convenient for targeting elements in javaScript, and as targets for anchor-links.