How to set an alternate text for area in HTML5 ?
In this article, we will learn how to specify an alternate text for an area in HTML5. This alternate text is displayed due to various reasons like the use of a screen reader, incorrect or non-existing image path in the src attribute, or a slow internet connection.
Approach: We will use the alt attribute of the area element. It provides alternate information about an element like an image or a link, when the element itself cannot be displayed. There may be various reasons for not being able to view the element like the path of the resource may have been changed, non-availability of the resource, or a slow internet connection.
<area alt="alternate text">
The below example demonstrates the above approach.
Example: In this example, both correct and incorrect paths to the images are provided, so that the alternate text of the area is visible when the incorrect path is specified.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.