HTML images with the img element
The <img> element embeds an image in a page using its source URL.
What you will learn
- How
srcandaltwork - How to provide meaningful alternative text
Minimal example
<img src="images/cat.jpg" alt="A cat sitting by a window">The browser loads the file named by src. The alt text is useful when the image cannot be seen.
Common mistakes
- Check the image path and filename case.
- Do not repeat information already given nearby in
alt. - Use an empty
alt=""only for decorative images.