0Pricing
HTML Academy · Lesson

id class style and title

Apply core global attributes to any HTML element.

Global Attributes

Global attributes can be applied to any HTML element:

  • id — unique identifier
  • class — one or more CSS classes
  • style — inline CSS
  • title — tooltip text
  • And many more: lang, hidden, tabindex, data-*...

The id Attribute

The id attribute assigns a unique identifier to an element:

<h2 id="installation">Installation Guide</h2>
<form id="signup-form">...</form>
<div id="hero-banner">...</div>

<!-- Rules:
  - Must be unique per page
  - No spaces
  - Use hyphens: user-profile
  - Case-sensitive: #hero ≠ #Hero
-->

All lessons in this course

  1. id class style and title
  2. The hidden Attribute
  3. tabindex and accesskey
  4. Custom Data Attributes data-*
← Back to HTML Academy