Alternative text is understood as a written text that, on the web, is associated with an image and that is visible if, at some point, the image cannot be loaded, or it takes time to load. Its aim is to replace the image if necessary. Therefore, with this text it must be tried to convey the same thing that appears in the image.
Alternative texts are important for the SEO, so they usually contain the keywords that you want to position in the blog entry or web page in question.
The alternative texts should not be confused with the so-called legends, which are the texts that appear at the bottom of the images. Captions are always visible, while alternative texts are only visible if, for some reason, the image is not.
Alternative text can be set in plain language. But, it is also possible to establish an alternative text in html. In the latter case, we can specify and modify various characteristics of the text, such as color, typography, location ...
What to put in the alt text?
Since the objective of the alternative text is that the reader does not lose information in case of unavailability of the images, it usually combines the description of the photograph or image, including, as we have said before, the word keywords. And, it must be written in the alt parameter (alternative text) of the code used to include or embed the image file on the web.
There are other cases in which it is also possible to view alternative texts, such as through the use of screen readers, which are normally intended for users with visual defects.
When an image is not relevant to the rest of the content of the text, but has a purely decorative character, the alternative text is really meaningless. For this reason, sometimes, a generic reference is made, such as photography, painting ... In these cases, it is recommended that the alternative text be brief.