Today I Learned - Rocky Kev

TIL Adding Tooltips without a library

POSTED ON:

TAGS:

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:

TIL Gmail has a 102KB size-limit for HTML

PLACEHOLDER

TIL how Error correction works in HTML

You never get an 'Invalid Syntax' error on an HTML page. Browsers fix any invalid content and go on.

TIL what DOCTYPE means

tl;dr: DOCTYPE declaration in the first line of the HTML file, to instruct the browser to run the code in Standard mode.