When to use classes and IDs

Classes and ids are the two most common ways of selecting elements. They both work similarly but there are some key differences.

  • IDs must be unique
  • IDs are faster for the computer to select (and not only because they’re unique)
  • It takes 256 classes to override one ID (css specificity)

Writing CSS for RTL websites