Simon Simon - 4 months ago 29
HTML Question

Wrapping title attribute

Firefox does not wrap words in

a
title
attribute:

<a title="longword"></a>


Is there a way to do word-wrapping in that case? I tried with:

<a title="longword" style="word-wrap:break-word;"></a>


but it does not work.

Chrome, instead, automatically wraps.

Answer

No, you cannot make Firefox deviate from its way of rendering title attribute values; cf. to How can I use a carriage return in a HTML tooltip?

The tooltips created by using title attributes are of questionable usability (tiny font that cannot be easily increased by the user; disapperance after some seconds; etc.), so they are suitable (at most) for short advisory titles (mainly for links), which not cause a need for wrapping.

For longer tooltips, consider using CSS techniques. Or just put the tip into the text proper.

Comments