HTML <img> Tag
The <img>
tag in HTML is utilized to insert an image into a web page.
Images are not directly placed on a web page; they are connected to web pages. The <img>
tag establishes a designated area for the connected image.
The <img>
tag comes with two necessary characteristics:
- src - Indicates the location of the picture.
- alt - Describes a substitute text for the image in case the image cannot be shown for any reason.
Note: Make sure to mention the width and height of an image every time. If you don't, the page might flash while the image is loading.
Tip: To connect an image to another document, just place the <img>
tag inside an <a> tag.