HTMLElement.title 属性表示元素的 title。当鼠标移到节点上时,会以“工具提示”(tool tip)的弹出形式显示该属性的属性值文本。

如果一个节点没有 title 属性(attribute),默认继承其父节点的相应属性,父节点可能是从父节点的父节点继承,依此类推。

根据 bug 264001,设置 title 为空字符串会触发默认继承行为。要取消继承,必须为 title 设一个非空的空白字符串。

 <div title="CoolTip>
   <div title="">mouse over here will popup "CoolTip"</div>
   <div title=" ">mouse over here will popup nothing"</div>


var string = element.title;
element.title = string;


 button1.title = "click to refresh";


We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)
Feature Android Chrome for Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) (Yes)