Last Updated: February 25, 2016
·
685
· flexbox

Cascading Style Sheet

NEVER use IDs in CSS.

They can be used in your markup for JS and fragment identifiers but use only classes for styling. You don’t want to see a single ID in any stylesheets !

2 Responses
Add your response

Can you explain why not?

over 1 year ago ·

Classes come with the benefit of being reusable (even if we don’t want to, we can) and they have a nice, low specificity.
Specificity is one of the quickest ways to run into difficulties in projects and keeping it low at all times is imperative. An ID is 255 times more specific than a class, so never ever use them in CSS ever.

over 1 year ago ·