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 GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
title |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
参见
- HTML title 全局属性。