0
0
HTMLmarkup~5 mins

Image tag usage in HTML - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the <img> tag in HTML?
The <img> tag is used to embed images in a web page. It displays pictures like photos, icons, or graphics.
Click to reveal answer
beginner
Which attribute of the <img> tag specifies the image file to display?
The src attribute tells the browser the path or URL of the image file to show.
Click to reveal answer
beginner
Why is the alt attribute important in the <img> tag?
The alt attribute provides alternative text describing the image. It helps screen readers for visually impaired users and shows text if the image fails to load.
Click to reveal answer
beginner
Can the <img> tag have a closing tag like </img>?
No, the <img> tag is self-closing. It does not have a separate closing tag. You write it as <img src="image.jpg" alt="desc">.
Click to reveal answer
intermediate
How can you make an image responsive so it adjusts to different screen sizes?
Use CSS styles like max-width: 100%; and height: auto; on the image. This makes the image shrink or grow to fit the container without distortion.
Click to reveal answer
Which attribute is required to display an image in HTML?
Aalt
Bsrc
Ctitle
Dhref
What happens if the alt attribute is missing and the image fails to load?
ANothing is shown
BThe browser shows the image file name
CScreen readers cannot describe the image
DThe page crashes
How do you write a self-closing <img> tag correctly?
A<img src="pic.jpg"></img>
B<img src="pic.jpg" />
C<img src="pic.jpg">
DBoth B and C
Which CSS style helps make images responsive?
Amax-width: 100%; height: auto;
Bposition: absolute;
Cfloat: left;
Dwidth: 500px;
What is the best practice for the alt attribute?
AWrite a short descriptive text
BLeave it empty if image is decorative
CUse the image file name
DOmit it always
Explain how to use the <img> tag to add an image to a webpage, including important attributes.
Think about what the browser needs to find and describe the image.
You got /4 concepts.
    Describe why accessibility matters when using images on websites and how the alt attribute helps.
    Consider users who cannot see images.
    You got /4 concepts.