What I put in as the image source URL in the failed images above is a legit URL. You can view the image just fine by clicking the link. It's just not the URL to the image itself.
Now, if I want the image to be the clickable thing for a hyperlink, like the words 'a legit URL' are above, I could do <a href="LINK"><img src="IMAGE URL" /></a> and it would work fine—for people who can view the image. Not so helpful for screenreader users or when the image doesn't load.
Here's such an image-as-hyperlink where the image fails as above and there isn't alt text:
And one where there is:
Also, if for whatever reason one wants an image to be present (as a decorative element or whatever) for people who can view images, but not to trouble people who don't, doing like <img src="IMAGE URL" alt="" /> means the screenreader will simply skip it. This is preferable to <img src="IMAGE URL" /> because the screenreader will read the file name, which is most likely unhelpful, and (as you see with my example image) sometimes total gibberish.
no subject
What I put in as the image source URL in the failed images above is a legit URL. You can view the image just fine by clicking the link. It's just not the URL to the image itself.
Now, if I want the image to be the clickable thing for a hyperlink, like the words 'a legit URL' are above, I could do <a href="LINK"><img src="IMAGE URL" /></a> and it would work fine—for people who can view the image. Not so helpful for screenreader users or when the image doesn't load.
Here's such an image-as-hyperlink where the image fails as above and there isn't alt text:
And one where there is:
Also, if for whatever reason one wants an image to be present (as a decorative element or whatever) for people who can view images, but not to trouble people who don't, doing like <img src="IMAGE URL" alt="" /> means the screenreader will simply skip it. This is preferable to <img src="IMAGE URL" /> because the screenreader will read the file name, which is most likely unhelpful, and (as you see with my example image) sometimes total gibberish.