👀 Live Preview
Hover over the text below to see the tooltip:
Hover me for a title tooltip

The title attribute is a global HTML attribute that lets you provide advisory information about an element. On most elements, browsers show this text as a tooltip when the user hovers with a mouse.
It works on links, images, paragraphs, abbreviations, and many other elements. Do not confuse it with the <title> element in the document <head>—that sets the browser tab label and affects SEO.
Hover text.
Most elements.
Not the same.
Expansions.
el.title.
Not primary.
titleThe primary purpose of the title attribute is to offer supplementary information displayed when a user hovers over an element (typically as a tooltip). It gives extra context without changing the visible page content.
Common uses include explaining abbreviated text on <abbr>, adding hints on icons or truncated labels, and naming embedded frames on <iframe title="..."> for accessibility.
The title attribute does not improve search rankings. Use the <title> element in <head> for page titles in search results.
Add title to any element with a text string:
<p title="This is a tooltip when you hover.">
Hover over this paragraph.
</p><iframe>, title names the frame for assistive technology (required for accessibility).HTMLElement.title (empty string removes advisory text).title on anchors.The title attribute accepts a single string value—any text you want to show as advisory information:
title="Save your document" — Hint on a button or icon.title="HyperText Markup Language" — Expansion on <abbr>.title="Product photo: blue running shoes" — Extra detail on an image (not a substitute for alt).title="Customer support chat" — Name for an <iframe>.<abbr title="World Health Organization">WHO</abbr>
<a href="/docs" title="Read the full documentation (PDF, 2 MB)">Docs</a>| Topic | Detail | Example |
|---|---|---|
| Format | Plain text string | title="Hint" |
| Display | Tooltip on hover | Mouse users |
| Scope | Global attribute | Most elements |
| JavaScript | element.title | Read/write string |
| Not the same as | <title> in head | Browser tab / SEO |
| iframe | Accessible name | Required for a11y |
| Element | Typical use of title | Notes |
|---|---|---|
<abbr> | Spell out abbreviation | Classic pattern |
<a>, <button> | Extra hint on hover | Don’t hide essential info |
<img> | Advisory note | Use alt for accessibility |
<iframe> | Frame description | Accessible name |
<p>, <span>, etc. | Tooltip text | Global attribute |
title attribute vs <title> element vs alt| Feature | Purpose | SEO / A11y |
|---|---|---|
title attribute | Tooltip / advisory text | Not for SEO; limited a11y |
<title> element | Document name in tab | Important for SEO |
alt on img | Image replacement text | Essential for a11y |
aria-label | Accessible name | Reliable for screen readers |
Paragraph tooltip, abbreviation expansion, and dynamic JavaScript updates.
Hover over the text below to see the tooltip:
Hover me for a title tooltip
Basic tooltip on a paragraph:
<p title="This is a tooltip message when you hover over this paragraph.">
This is a paragraph with a title attribute.
</p>The title attribute on the paragraph provides a tooltip when the user hovers over it. The visible text stays unchanged.
A practical use on <abbr>:
<p>
The <abbr title="HyperText Markup Language">HTML</abbr>
title attribute shows the full form on hover.
</p>Readers see “HTML” but hovering reveals the full phrase. Include the expansion in visible text when possible for keyboard-only users.
Update tooltip text at runtime:
<p id="dynamicParagraph">
This paragraph will have a dynamically set title attribute.
</p>
<script>
document.getElementById("dynamicParagraph").title = "Updated tooltip message.";
</script>In this script, the title for the paragraph with id dynamicParagraph is set after the page loads. Useful when tooltip content depends on live data or user state.
title tooltips. Put essential information in visible text.alt on images — Not title — for meaningful image descriptions.title on iframes — It provides the accessible name of the embedded frame.title on <a> adds noise for some assistive tech.title string.
Pointer device.
Native tooltip.
On hover.
The title attribute is universally supported. All major browsers display native tooltips for title on hover (timing and styling vary).
Chrome, Firefox, Safari, and Edge all honor the title attribute.
Bottom line: Tooltip support is reliable; do not depend on it for critical accessibility information.
<abbr> with titletitle on <iframe> elementstitle attribute with <title> elementalt on images with titleThe title attribute is a useful way to offer supplementary information through native tooltips without cluttering visible content. Applied thoughtfully on abbreviations, icons, and frames, it improves clarity for pointer users.
Remember the limits: it is not for SEO, not a replacement for accessible names, and not visible to all users. Pair it with visible text and proper semantic HTML for the best experience.
titleBookmark these when adding tooltips.
Hover text
PurposeMost elements
ScopeDifferent feature
ClarifyJavaScript
DynamicAdvisory only
Limits<title> element in <head> sets the browser tab title.<title> element, not body element title attributes.element.title, for example p.title = "New hint".alt for accessible image descriptions. title is optional advisory text only.Hover over the paragraph in the editor to see the title attribute in action.
5 people found this page helpful