TIL Adding Tooltips without a library
POSTED ON:
That can be added with the title
attribute, and used for a lot of different types of items.
<p>
<abbr title="Dragon Ball Z">DBZ</abbr> has Goku go super Saiyan.
</p>
For Multiline:
<p>Newlines in <code>title</code> should be taken into account,
like <abbr title="This is a
multiline title">example</abbr>.</p>
There's also inheritance:
<div title="CoolTip">
<p>Hovering here will show “CoolTip”.</p>
<p title="">Hovering here will show nothing.</p>
</div>
The major issue is accessibility!
The MDN recommends a tip for that
REFERENCE:
mdn title
Related TILs
Tagged: html