Images are an essential part of web pages. To add an image to your HTML document, you use the <img> tag. Unlike many other HTML elements, the image tag is self-closing, which means it doesn't have a separate closing tag.
The basic syntax of an image tag looks like this:
Loading editor...
The <img> tag requires at least two attributes:
1.
src (source): Specifies the path to the image
2.
alt (alternative text): Provides a text description of the image
↗️
Loading editor...
↶
↷
Self-closing Tags
The <img> tag is one of several self-closing tags in HTML, which means they don't need a closing tag. Other examples include <br>, <hr>, and <input>. You may also see them written with a forward slash at the end like <img /> which is valid in HTML5.