What is meant by Images must have alternate text: Element has no title attribute
I had created img tag but developer tools gives me a warning but i can't understand what that means.
Affected resources
<img src="./img/twitter.png">
CodePudding user response:
This has to do with screen readers. Screen readers have no way of translating an image into words that gets read to the user, even if the image only consists of text. As a result, it's necessary for images to have short, descriptive alt text so screen reader users clearly understand the image's contents and purpose.
There are 3 ways to give an image alternate text:
Using an alt attribute i.e.
<img alt="drawing of a cat" src="...">
Using an aria-label i.e.
<img aria-label="drawing of a cat" src="...">
Using an aria-labelledby attribute i.e.
<img arialabelledby="someID" src="..."
CodePudding user response:
The alt
attribute is needed when the picture is not available or the user turned all pictures off in his/her browser. It's necessary to include this attribute to your img
elements.
<img src=".." alt="Alternative text" width="200" height="100" aria-label="For screen readers" />
CodePudding user response:
Use alternate txt for img
tag like this : <img src="./img/twitter.png" alt="tweetImg">
.
As it is important, if there is slow connection the alternate txt will be visible or due to some error your image don't show up .
The HTMLImageElement property alt provides fallback (alternate) text to display when the image specified by the element is not loaded.
This may be the case because of an error, because the user has disabled the loading of images, or because the image hasn't finished loading yet.