HTML `` Element: Enhancing Media Playback Compatibility

Learn how to use the HTML `` element to provide multiple media sources for `



Using the HTML `` Element for Media Playback

Understanding the `` Element

The HTML `` element is used to specify multiple media resources for media elements like `

How the `` Element Works

The `` element is always placed *inside* a media element (`

Example: `` Element in an `

<audio controls>
  <source src="audio.mp3" type="audio/mpeg">
  <source src="audio.ogg" type="audio/ogg">
  Your browser does not support the audio element.
</audio>

Browser Support for ``

The `` element is widely supported by modern browsers. Check the W3Schools Browser Support page for detailed compatibility information.

Browser Version
Chrome 4.0
Edge 9.0
Firefox 3.5
Opera 4.0
Safari 10.5

`` Attributes

Attribute Value Description
media Media query Specifies the media type (screen size, etc.).
sizes Size description Specifies image sizes for different layouts (used with `srcset`).
src URL Specifies the URL of the media resource.
srcset URL list Specifies multiple image sources for different resolutions (used with ``).
type MIME type Specifies the MIME type of the media resource.

The `` element also supports standard HTML global and event attributes.