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 !
Written by David Leuliette
Related protips
2 Responses
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#