HTML CSS JavaScript SEO Python Posts Privacy About Contact

HTML Images

Images can improve the design and the appearance of a web page.

The HTML <img> tag is used to embed images in a web page. Images are not inserted — they are linked from a source URL.

The <img> tag is self-closing (no end tag needed) and has two required attributes:

  • src — the path or URL to the image file
  • alt — a text description shown if the image fails to load

Try It — Images with src, alt, and sizing

Preview

Image Attributes Reference

AttributeRequired?What it does
src✅ YesPath or URL to the image
alt✅ YesFallback text if image fails to load
widthNoSets image width in pixels
heightNoSets image height in pixels

Tip: Always include the alt attribute! It improves accessibility for screen reader users and helps search engines understand your content.