Adding the title to the IMG SRC tag displays a message for the image as shown in the below code.

Example img HTML code

Computer Hope guy holding CH logo

The above code displays “Visit Computer Hope” when a mouse hovers over the image in all browsers. In the above example, we also used the alt attribute to describe the image. Some browsers also use this attribute as the hover text. We recommend using the alt attribute to describe the image for search engines and the visually impaired and the title attribute for the hover text. Below is an example of the above code in action. If you hover your mouse over the picture, it displays the “Visit Computer Hope” message.

Example

  • Should I add the height and width to the img src tag?
  • Why an HTML image alt text doesn’t show on hover.
  • HTML and web design help and support.