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 July 2015.

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

一个字符串。

示例

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

规范

Specification
HTML
# dom-title

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
title

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

参见

  • HTML title 全局属性。