In this section, we will see what the alt attribute is and how to use it.
What is alt Attribute in HTML <input> Tag?
The alt attribute stands for alternative and is used in HTML <input> of type “image” to set a text description for the image that is used in the <input> src attribute.
If for whatever reason the target image didn’t load in the document, the value of the alt attribute will be rendered instead.
Also, Search Engines like Google, read the value of this alt attribute to learn more about the target image.
HTML alt Attribute in <input> Tag Syntax:
<input type = “image” src = “image-address” alt = “text description about the image”>
<input> Tag alt Attribute Values
The value we set for the alt attribute is a text description that explains what that image is.
Example: using alt attribute in HTML <input> tag
See the Pen using alt attribute in HTML <input> tag by Omid Dehghan (@odehghan) on CodePen.