HTML has <img> tag to add image in the web page. img stands for image. <img> tag has attributes to include image source url, image width, image height, border and much more. <img> is empty tag, it does not have closing tag.
Basic Syntax of <img> tag<img src="/image url" />
<img src="images/logo.png" alt="" width="50px" height="20px" />
src stands for source. Image src attribute is used to include a image. The image path is the value of src attribute.
The src attribute can include all types of images.
The image path or url should be valid. Always make sure to provide the correct directory name.
Suppose, the file that contains the img element is in the root directory and images are in folder name 'images'. Then we can call this image as -
<img src="images/demo.png" />
we can also include image from the external server
<img src="https://www.etutorialspoint.com/images/demo.png" />
Image width and height
Width and Height attributes specify the width and height of the image respectively.
<img src="images/logo.png" width="50px" height="20px" />
alt attribute specifies the description of the image.
<img src="images/demo.png" alt="This is demo image." />