HTML Image Tag

  • Purpose: To insert an image into an HTML document.
  • Tags: <img>
  • Attributes
    • src: Specifies the URL or path to the image file.
    • Alt: Provides an alternative text description for the image, which is displayed if the image cannot be loaded or for users with screen readers.
    • width: Sets the width of the image in pixels or as a percentage.
    • height: Sets the height of the image in pixels or as a percentage.
  • Example:
<img src="image.jpg" alt="A beautiful landscape" width="300" height="200"> 

The HTML Image Tag is used to embed images in a webpage. It’s a self-closing tag, meaning it doesn’t require a closing tag

Scroll to Top