We use the title
attribute in HTML to specify the extra information about the element. The additional information appears whenever the mouse hovers over the element.
Note: All HTML
tags
support this attribute.
We'll use the syntax below to add the title
attribute to an HTML element:
<element title='text'>
Here element
can be any sort of HTML tag
, for example, <p>,<a> and <img>
, and others.
The following code snippet illustrates the use of the title
attribute in the h3
tag of HTML:
title
attribute in a <h3>
tag. The result is shown in the output tab of the widget above.<h3>
tag.Similarly, we can make use of the title
attribute on <img>
tag as well. This is depicted by the code snippet below:
title
attribute in an <img>
tag and sets it to the value of Educative Inc.
This answer summarizes the primary use of the title
attribute along with code snippets to demonstrate its functionality.
Free Resources