What is Image tag in HTML?

Image tag is used to embed an image in a html page. Images are not technically inserted into a web page but they are linked to the page. The image tag creates a holding space with the reference image. It has two required attributes. First is source image path (src), specifies the path of an image and second is alternate text (alt) specifies an alternative text for an image. If the image for some reason cannot be displayed then the alt text will be displayed in the web view.

Image tag is a self-closing tag for clear image we can take the help of attributes ‘height’ and ‘width’ to define the size of image.

Map tag is used to define an image map (images with clickable areas). The required name attribute of the map element is associated with the usemap attribute.

To create a relationship with the image and the map we use another tag called Area tag, it defines an area inside an image map. All the area elements are listed inside the map tag.

The figure tag specifies a self-contained illustration, diagrams, photos, code listing etc., While the content of the figure element is related to the main flow, its position is independent of the main flow and if its removed it will not affect the flow of the document.

The figcaption tag is used to define caption for the figure element. It can be placed as the last child of the figure element.

The picture tag gives the web developer more flexibility in specifying image resources. The most common use of the picture element will be for art direction, instead of having one picture that scaled up or down based on the viewport, multiple images can be designed more nicely to fill the browser viewport. The picture element contains two tags, source tag and image tag.

To style anything in HTML there are two ways:

  • Inline styling
  • External styling