HTML Image Tag – src, alt, width, height Attributes with Examples



 


Definition of HTML Image Tag

The HTML image tag <img> is used to display images on a webpage. It helps add photos, logos, icons, and graphics to make a website more attractive and informative.

The <img> tag is an empty tag, which means it does not need a closing tag.

Syntax

<img src="image.jpg" alt="Description of image">

Important Attributes

  • src – Specifies the path (URL) of the image.
  • alt – Alternative text shown if the image cannot load.
  • width – Sets image width.
  • height – Sets image height.

Example

<img src="flower.jpg" alt="Beautiful Flower" width="300" height="200">


Post a Comment

0 Comments