此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

HTMLElement:title 属性

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2015年7月⁩.

HTMLElement.title 属性表示元素的标题:当鼠标悬停于节点上时,通常会以“工具提示”(tooltip)的弹出形式显示该文本。

一个字符串。

示例

js
const link = document.createElement("a");
link.innerText = "葡萄";
link.href = "https://zh.wikipedia.org/wiki/葡萄";
link.title = "维基百科页面上的葡萄";

规范

Specification
HTML
# dom-title

浏览器兼容性

参见

  • HTML title 全局属性。