Last updated

Images

Definition: The <img> tag displays a picture. Unlike most tags it has no closing tag and no content — everything is in its attributes.

Basic image

<img src="photo.jpg" alt="A description" width="300">
  • src — the image address (a URL or file name)
  • alt — text shown if the image fails, and read by screen readers
  • width / height — the size in pixels

Why alt text matters

The alt attribute describes the image. It helps visually impaired users and improves SEO, so never skip it.

The example below loads a random placeholder photo. Change the numbers in the URL to change its size.

💡 Tip: set only the width and the image keeps its proportions automatically.

Try it Yourself
Output

          
Ad · responsive