← All tutorials

GoCareerGo Tutorials

HTML Tutorial

Tags, attributes, HTML5 APIs and semantic markup — the web's foundation.

Adding CSS: class and id

class and id are the two attributes CSS selectors and JavaScript most commonly hook into.

  • id — must be unique on the page; targeted with #idName
  • class — reusable across many elements; targeted with .className
  • An element can have multiple classes: class="card featured"
<div id="header" class="card featured">...</div>