5 attributes for an image in HTML

To embed an image in an HTML page, The <img> tag is used. The <img> tag has some attributes.

  1. src - Specifies the path to the image.
    <img src="https://app.3schools.in/logo.png">
    The src attribute is required to display an image.
  2. alt - it is used to specify the alternate text for an image. It is shown when the image not displayed.
    <img alt="logo">
    Try it Yourself »
  3. height - Specifies the height of an image.
    <img height="200">
  4. width - Specifies the width of an image.
    <img width="200">
  5. loading - all images are not loaded as soon as someone visits your website.
    <img loading="lazy">