<img> tag
Goal
- âš¡ Learn how to use
<img>
tag
img
tag ?
What is The
<img>
tag defines an image in an HTML page.
https://www.w3schools.com/tags/tag_img.asp
img
tag
Try Googling: "public domain cats image wiki commons"
And then, please "copy image address"
In test1.html
Check the output
Image size is too big...
width
and height
attributes
Add width
and height
attributes to adjust image size.
Check the output
alt
attribute?
What is The required alt attribute specifies an alternate text for an image, if the image cannot be displayed.
The alt attribute provides alternative information for an image if a user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).
https://www.w3schools.com/tags/att_img_alt.asp
alt
attributes
Try and check Add alt="Hello this is cat image"
to img
tag.
Make your PC airplane mode
This is for making the situation when you cannot access image.
Open file in incognito window mode
Even though you are offline, you can access image because image cache remains.
To disable cache, open test1.html
file in incognito window.
And then, you see the effect of alt
attribute.