HTML Attributes

What are Attributes?

Attributes provide additional information about HTML elements. They are placed inside the opening tag and consist of a name and value.

Common Attributes

  • id: Unique identifier for an element
  • class: Class name(s) for CSS styling
  • style: Inline CSS styles

Using Attributes in Elements

<p id="intro" class="text-lg" style="color: blue;">This paragraph has attributes.</p>