The title attribute
The title
attribute specifies a tooltip for an element that will appear when you hover over the element with the mouse (you need to hover and hold the cursor for a second or two).
Unfortunately, it is not possible to apply any CSS styles to this tooltip, and the tooltip does not look very good (use JavaScript to make a styled tooltip).
Example
Let's try hovering the mouse over the paragraph text from the example - and we'll see the contents of the title
attribute as a tooltip:
<p title="it's a title">hover me!</p>
:
See also
-
attribute
placeholder
,
which sets the hint for the input field -
attribute
alt
,
which sets alternative text for an image