HTML Images
Images add pictures to a web page. HTML uses the <img> element for an image. The src attribute tells the browser which image file to load. The alt attribute describes the image in words. Alt text is useful when the image cannot load and for people using screen readers. Example: <img src="cat.jpg" alt="A small orange cat">. <img> does not wrap text, so it does not need a closing </img> tag. You can also use width and height when you need to control the image dimensions, while CSS is usually better for responsive design.
Why this matters
- ·Images can explain ideas quickly.
- ·Alt text makes meaningful images more accessible.
- ·src separates the image location from the rest of the page.
Common mistakes
- ·Missing alt text can make important images difficult to understand.
- ·Huge images can make pages slow.
- ·Do not write useless alt text such as "image of image".
Frequently asked questions
It tells the browser where the image file is.
Practice questions
Question 1
Add an image with useful alt text.
Question 2
Make an image clickable by placing it inside a link.
Quick check
Just for this topic answer honestly, then check yourself.
1 / 3
