06 / 07

What does the title attribute do ?

Using the title Attribute in HTML

The title attribute in HTML provides additional information about an element. When a user hovers over the element with their mouse, most browsers display the title text as a small tooltip. It is often used to give hints, descriptions, or extra context about an element.

Example: Using the title Attribute
Key Points About the title Attribute
  1. 1

    The title attribute shows a tooltip when the user hovers over an element.

  2. 2

    It can be applied to most HTML elements, including links, paragraphs, images, and buttons.

  3. 3

    It is useful for adding descriptions or hints without cluttering the page.

  4. 4

    Overusing the title attribute for accessibility is not recommended; use ARIA attributes or proper labels instead.

  5. 5

    Some mobile browsers may not display the title tooltip because there is no hover state.