CKTIS / HTML
HTML term or value: title
The `title` attribute supplies advisory text associated with an element; a browser may show it as a tooltip, but exposure and interaction depend on the device.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
<abbr title="HyperText Markup Language">HTML</abbr>For an ordinary element without special title semantics, advisory information inherits from the nearest ancestor when the element has no own title; an explicit empty value stops that inheritance. Newlines separate lines of advice, but authors must not assume a particular tooltip presentation.
On abbr, a present value must contain the full expansion of the abbreviation and nothing else; on dfn, it gives the exact term being defined. On a link used for a stylesheet while in a document tree, the attribute names a stylesheet set; on other links it remains ordinary advisory text. On style, it likewise names a stylesheet set.
When an input has pattern and a title is supplied, that title must describe the required pattern, but it must not be the only instruction. Use visible text or an aria-describedby relationship; title can only supplement the information because touch and keyboard users and assistive technologies may not receive a tooltip.
The example shows that title="" on the second child stops ancestor advice; the first child’s reflected title property is "" because it has no own attribute, but its nearest advisory source is the parent’s Parent hint.
Examples
<!doctype html><meta charset="utf-8"><div id="p" title="Parent hint"><span id="x">Child</span><span id="stop" title="">Stop</span></div><output id="result"></output><script>const child=document.querySelector("#x"),boundary=document.querySelector("#stop");result.textContent=`childOwn=${child.title}; childSource=${child.closest("[title]").title}; stopOwn=${boundary.title}; stopSource=${boundary.closest("[title]").title}`;</script>Result
childOwn=; childSource=Parent hint; stopOwn=; stopSource=
The executed example verifies advisory inheritance when the attribute is absent and the boundary established by an explicitly empty value.