<source>

The source element specifies one of multiple media or image resources for picture, audio, or video.

Since HTML5 Spec ↗

Syntax

<source src="url" type="mime">

Examples

<picture>
  <source srcset="/hero.avif" type="image/avif">
  <source srcset="/hero.webp" type="image/webp">
  <img src="/hero.jpg" alt="Hero">
</picture>
Output
Renders the first supported image format (AVIF, then WebP, then the JPEG fallback).

Notes

It is a void element. Inside <picture> use srcset and media; inside <audio>/<video> use src and type. The browser picks the first compatible source.

Browser & runtime support

EnvironmentSince version
chrome 4.0
firefox 3.5
safari 4.0
edge 12

See also