HTML Images

HTML images are used to display visual content on a web page.
Images are added using the <img> element.


Basic Image Syntax

<img src="image.jpg" alt="Sample image">

Image with Common Attributes

<img 
  src="banner.jpg"
  alt="Website banner"
  width="600"
  height="300"
  loading="lazy"
  title="Main banner image">

Attributes Used

  • src → image path
  • alt → alternative text
  • width / height → image size
  • loading → load behavior
  • title → tooltip text

Image Paths

<img src="images/logo.png" alt="Company logo">

Important Notes

  • alt is required for accessibility
  • Always use correct image paths
  • Images are inline elements