RSRobince Studio

Classes and IDs

The class and id attributes let you name elements so CSS and JavaScript can find them.

  • A class can be reused on many elements
  • An id must be unique on the page, used by one element only

In CSS, you target a class with a dot (.name) and an id with a hash (#name).

Try it yourself

Loading editor…