HTML title Attribute

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The title global attribute holds advisory text about the element. Browsers often show it as a tooltip on hover. Per MDN, a strong use case is labeling <iframe> content for assistive technology.

Not the same as the document <title> in <head>. Related: <abbr>, <label>, alt, lang.

Baseline · Widely available.

Not deprecated and not experimental. A standard global attribute across modern browsers since about July 2015.

Accessibility warning.

Per MDN: tooltips from title are unreliable for touch, keyboard-only, and many assistive-tech users. Do not put essential information only in title. Prefer visible text and a real <label> for controls.

HTML Syntax

syntax.html
<element title=" text">

text is advisory information. Equivalent JS: el.title = "Hint".

Attribute Values

The value is plain text. Common patterns:

Value / patternDescriptionTry it
On <iframe>Recommended — names the frame for ATTry it
On <abbr>Full expansion (prefer visible text on first use too)Try it
Inherited / title=""Empty string blocks ancestor tooltip inheritanceTry it
MultilineLF characters may create line breaks in the tooltipTry it

Live Preview

Edit the advisory text, then hover the sample (desktop). Touch devices often cannot open title tooltips — that is the accessibility limit.

Hover the marked text if your device supports native tooltips. Do not rely on this for critical content.

Preview

Hover this phrase to see the browser tooltip (when available).

title="Advisory tip — hover me"

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Label an iframe (Recommended)

MDN’s main practical use: identify embedded content for assistive tech.

HTML
<iframe
  title="Wikipedia page for the HTML language"
  src="https://en.m.wikipedia.org/wiki/HTML"
  width="100%"
  height="200">
</iframe>
Try It Yourself

How It Works

  1. Add title on the iframe with a short, clear description.
  2. Assistive tech can announce that name when users land on the frame.
  3. Each iframe needs its own title if you embed more than one.
  4. Prefer this pattern over using title only as a decorative tooltip.

Example 2 — Abbreviation Expansion

Mark the short form; expand visibly on first use when you can.

HTML
<p>
  We teach
  <abbr title="HyperText Markup Language">HTML</abbr>
  (HyperText Markup Language) first.
</p>
Try It Yourself

How It Works

  1. <abbr> marks the abbreviated term.
  2. title can hold the full expansion for supporting UAs.
  3. MDN tip: also write the expansion in visible text on first use.
  4. Everyone benefits — not only users who can hover a tooltip.

Example 3 — Inheritance and Empty title

Children inherit a parent’s title unless they set their own (including empty).

HTML
<div title="CoolTip">
  <p>Hovering here may show "CoolTip".</p>
  <p title="">Hovering here should show nothing.</p>
</div>
Try It Yourself

How It Works

  1. No title on a child → may inherit from an ancestor.
  2. title="" means ancestor titles are irrelevant for that element.
  3. Useful when a parent tip must not apply to one nested control.
  4. Still advisory only — never the only place critical text lives.

Edge Cases & Pitfalls

Most problems come from treating title tooltips as accessible labels or essential instructions.

a11y

Not for essential content

Touch and keyboard users often never see the tooltip. Keep important text visible on the page.

forms

Do not replace <label>

MDN: using title as the only label for an input is not good practice.

vs element

Attribute ≠ <title> element

The head element sets the document name. The attribute is advisory text on any element.

images

Prefer alt for images

Meaningful image text belongs in alt, not only in title.

stylesheets

Alternate stylesheets

On <link rel="stylesheet">, a non-empty title can mark an alternate style sheet (specialized use).

Browser Support

title is an HTML global attribute in the browser. It is not a Node.js, Deno, or Bun API.

✓ Widely available

title

Supported in all modern browsers. Tooltip UX and AT exposure vary — do not rely on it alone.

97% Global support (approx.)
Google Chrome All modern
Full support
Mozilla Firefox All modern
Full support
Apple Safari All modern
Full support
Microsoft Edge All modern
Full support
Opera All modern
Full support
Samsung Internet Modern
Full support
Internet Explorer All
Supported
title Widely supported

Bottom line: Safe as advisory text and iframe names. Keep essential information visible without depending on hover tooltips.

Key Takeaways

  • Role: advisory text (often a hover tooltip).
  • Best use: name <iframe> content for assistive tech.
  • Not a label for inputs — use <label>.
  • ≠ the document <title> element.

One line: title is advisory — great for iframe names; never the only place for essential text.

Frequently Asked Questions

It holds advisory text for the element — often shown as a browser tooltip on hover. MDN highlights labeling iframes for assistive technology as a primary good use.
No. The title attribute is a global attribute on any element. The title element in the document head sets the page name in the browser tab and search results.
No. MDN: that is not good practice. Use a visible label element instead. Title tooltips are unreliable for keyboard, touch, and many assistive tech users.
Yes. If an element has no title, it may inherit from an ancestor. An empty title="" means ancestor titles should not apply to that element’s tooltip.
Yes. A line feed (LF) in the attribute value can create a multiline tooltip in supporting browsers.
No. It is a standard global attribute. The caution is accessibility: do not put essential information only in title.

Next: translate

Control whether an element’s text may be translated.

translate tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful