skip to content

Why is the title attribute on an img element not a substitute for its alt attribute?

level: middleimportance: should knowfreq 45%

answer

  1. one is a substitute, one is an aside
  2. hover is the delivery mechanism
  3. keyboard and touch never get it
  4. announcement is a user setting
  5. only fills in when alt is absent

basics

~20 s

The title attribute renders only as a hover tooltip, so keyboard and touch users never see it, and screen reader exposure of title is inconsistent and often switched off. Alt is the defined text alternative for an image; title is optional advisory information.

solid answer

~50 s

`title` is defined as *advisory* information, and browsers surface it as a mouse-hover tooltip. That delivery mechanism excludes almost everyone who needs the alternative: keyboard users cannot hover, touch users get nothing reliable, and the tooltip disappears on the smallest movement. Screen reader support for `title` is inconsistent, and several readers let users switch off title announcement entirely, so you cannot count on it being read. `alt`, by contrast, is the specified text alternative for `<img>` — it is what the accessibility tree uses to name the image and what the browser shows when the image fails to load. In practice, if `alt` is missing, `title` may end up used as the fallback name for the image, which is exactly why people believe title "works". It is a fallback, not a plan. Write real `alt`; add `title` only for genuinely optional extra detail, and never for anything a user must have.

go deeper

for a junior

Know that alt is the required text alternative and title is only a hover tooltip. Saying "use alt, title is optional extra detail" is a complete answer at this level.

for a middle

Explain why the delivery mechanism is the problem: hover excludes keyboard and touch entirely, and title announcement is inconsistent and user-configurable in screen readers. Mention that title may be used as a fallback name only when alt is absent, which is why it seems to work.

for a senior

Show you can spot the pattern in a real codebase — tooltips carrying instructions, title duplicating alt, or a component library that ships title on every icon — and describe the replacement: visible text, with a programmatic association only where the text lives elsewhere.

for a principal

Be ready to make it a standard rather than a fix: no information-bearing content in title anywhere in the design system, tooltip components that reveal on focus as well as hover, and a lint or review rule so the pattern cannot re-enter through a new component.

## Two attributes, two jobs `alt` and `title` are both text you attach to an `<img>`, which is why they get confused, but the specification gives them different jobs. - `alt` is the **text alternative**: the substitute content for the image. It is what a browser paints in the image's box when the file fails to load, and it is what names the image in the accessibility tree. - `title` is **advisory information**: an aside. "This chart was recorded on a Tuesday." Nothing in the page's meaning may depend on it. ```html <!-- alt carries the content; title adds an optional aside --> <img src="map.png" alt="Office location: 4 King Street, two blocks north of Central station" title="Map updated March 2026"> ``` ## Why the delivery mechanism disqualifies `title` Browsers render `title` as a tooltip that appears after a mouse pointer rests over the element. Every part of that sentence is a barrier: - **Keyboard users** never produce a hover. Moving focus to an element does not show its tooltip. - **Touch users** have no hover state at all. On phones and tablets the tooltip generally never appears. - **Low-vision users** who magnify the screen may push the tooltip off the visible region, and the tooltip's styling is entirely browser-controlled — you cannot enlarge its text or fix its contrast. - **Anyone with a tremor or limited fine motor control** loses the tooltip the moment the pointer drifts. So the one group reliably served by `title` is sighted mouse users, who are also the group already looking at the image. ## Screen reader exposure is not something you can rely on Screen readers historically differ over whether they read `title`, when they read it, and whether they read it in addition to or instead of other text. Several expose a user setting for it, and some ship with it off by default because tooltip text is so often duplicated junk. The upshot: a string in `title` may be announced, announced twice, or silently ignored, and the author cannot tell which. Content whose delivery is a coin flip is not an alternative. There is a further trap. When an `<img>` has no `alt` at all, the browser may fall back to `title` when computing the image's name. That fallback is why teams observe title "working" on one machine and conclude it is interchangeable with alt. It is a repair path for broken markup, not a design. ## The failure modes you actually see 1. **`title` used instead of `alt`.** The image ends up with no defined alternative; validation flags the missing attribute, and behaviour depends on the reader's settings. 2. **`title` duplicating `alt` word for word.** Some combinations announce both, so the user hears the same sentence twice. If the string is worth saying, it belongs in `alt` alone. 3. **`title` holding essential instructions.** Anything a user must know to complete a task cannot live in a tooltip. Put it in visible page text. ## What to use instead of a tooltip If the extra information matters, make it visible content. A caption beneath the image, a line of help text, or a short paragraph is available to everyone and can be styled, translated and tested. When the visible text sits elsewhere in the page and you want it associated with the image programmatically, `aria-describedby` on the `<img>` pointing at that text's `id` is the mechanism — but visible text is the win, and the association is the refinement. The short version to say in an interview: `alt` is required content that replaces the image; `title` is optional decoration delivered by a mechanism that excludes keyboard, touch and many assistive-technology users. Write the alt.

  • Is there any case where you would put title on an image?
    Rarely, and only for genuinely disposable extra detail — a capture date, a photographer credit that is also printed elsewhere. The test is whether losing it costs anyone anything. If the answer is yes, it belongs in visible text, not in a tooltip. Duplicating the alt string into title is never useful and can cause a doubled announcement.
  • A designer wants a custom-styled tooltip on an image instead of the native one. What do you tell them about the accessibility side?
    That building a visual tooltip does not by itself make the text available to assistive technology, and hover-only reveal still excludes keyboard and touch users. The information has to be reachable another way — visible text, or text associated with the image through `aria-describedby` — and the trigger has to respond to focus, not only to hover.

saying these in an interview costs you the question

  • Says title and alt are interchangeable
  • Puts required instructions in a tooltip
  • Duplicates the alt string into title
  • Assumes every screen reader announces title
  • Thinks a tooltip appears on keyboard focus

context