Attributes: Adding More Details

HTML tags can have attributes that provide additional information. Some commonly used attributes include:

  • id: A unique identifier for an element.
    • Example: <div id="header">This is the header</div>
  • class: Used to classify multiple elements.
    • Example: <p class="intro">This is an introductory paragraph.</p>
  • src: Specifies the source of an image.
    • Example: <img src="logo.png" alt="Company Logo">
  • href: Specifies the destination URL of a link.
    • Example: <a href="https://www.example.com">Go to Example</a>